test: add more tests for throws and their messages

This commit is contained in:
Aleksey Kulikov 2021-10-19 17:16:39 +03:00
parent d6eae1e9ed
commit 127849519d
80 changed files with 2741 additions and 1501 deletions

View file

@ -56,18 +56,10 @@ Pointer<git_signature> now({required String name, required String email}) {
///
/// This looks up the user.name and user.email from the configuration and uses the
/// current time as the timestamp, and creates a new signature based on that information.
///
/// Throws a [LibGit2Error] if error occured.
Pointer<git_signature> defaultSignature(Pointer<git_repository> repo) {
final out = calloc<Pointer<git_signature>>();
final error = libgit2.git_signature_default(out, repo);
if (error < 0) {
calloc.free(out);
throw LibGit2Error(libgit2.git_error_last());
} else {
return out.value;
}
libgit2.git_signature_default(out, repo);
return out.value;
}
/// Free an existing signature.