style: clean up tests names

This commit is contained in:
Aleksey Kulikov 2021-12-23 15:29:28 +03:00
parent 41fab98d17
commit c516119397
33 changed files with 212 additions and 223 deletions

View file

@ -58,7 +58,7 @@ void main() {
}); });
group('Blame', () { group('Blame', () {
test('successfully gets the blame for provided file', () { test('returns the blame for provided file', () {
final blame = repo.blame( final blame = repo.blame(
path: 'feature_file', path: 'feature_file',
oldestCommit: repo['f17d0d4'], oldestCommit: repo['f17d0d4'],
@ -113,9 +113,7 @@ void main() {
blame.free(); blame.free();
}); });
test( test('returns the blame for provided file with minMatchCharacters set', () {
'successfully gets the blame for provided file with '
'minMatchCharacters set', () {
final blame = repo.blame( final blame = repo.blame(
path: 'feature_file', path: 'feature_file',
minMatchCharacters: 1, minMatchCharacters: 1,
@ -127,7 +125,7 @@ void main() {
blame.free(); blame.free();
}); });
test('successfully gets the blame for provided line', () { test('returns the blame for provided line', () {
final blame = repo.blame(path: 'feature_file'); final blame = repo.blame(path: 'feature_file');
final hunk = blame.forLine(1); final hunk = blame.forLine(1);
@ -162,9 +160,7 @@ void main() {
blame.free(); blame.free();
}); });
test( test('returns the blame for provided file with newestCommit argument', () {
'successfully gets the blame for provided file with '
'newestCommit argument', () {
final blame = repo.blame( final blame = repo.blame(
path: 'feature_file', path: 'feature_file',
newestCommit: repo['fc38877'], newestCommit: repo['fc38877'],
@ -191,9 +187,8 @@ void main() {
blame.free(); blame.free();
}); });
test( test('returns the blame for provided file with minLine and maxLine set',
'successfully gets the blame for provided file with minLine and ' () {
'maxLine set', () {
final blame = repo.blame( final blame = repo.blame(
path: 'feature_file', path: 'feature_file',
minLine: 1, minLine: 1,

View file

@ -24,7 +24,7 @@ void main() {
}); });
group('Blob', () { group('Blob', () {
test('successfully initializes blob from provided Oid', () { test('lookups blob with provided oid', () {
final blob = repo.lookupBlob(repo[blobSHA]); final blob = repo.lookupBlob(repo[blobSHA]);
expect(blob, isA<Blob>()); expect(blob, isA<Blob>());
blob.free(); blob.free();
@ -48,7 +48,7 @@ void main() {
blob.free(); blob.free();
}); });
test('successfully creates new blob', () { test('creates new blob with provided content', () {
final oid = repo.createBlob(newBlobContent); final oid = repo.createBlob(newBlobContent);
final newBlob = repo.lookupBlob(oid); final newBlob = repo.lookupBlob(oid);
@ -68,8 +68,7 @@ void main() {
); );
}); });
test('successfully creates new blob from file at provided relative path', test('creates new blob from file at provided relative path', () {
() {
final oid = repo.createBlobFromWorkdir('feature_file'); final oid = repo.createBlobFromWorkdir('feature_file');
final newBlob = repo.lookupBlob(oid); final newBlob = repo.lookupBlob(oid);
@ -88,7 +87,7 @@ void main() {
); );
}); });
test('successfully creates new blob from file at provided path', () { test('creates new blob from file at provided path', () {
final outsideFile = final outsideFile =
File('${Directory.current.absolute.path}/test/blob_test.dart'); File('${Directory.current.absolute.path}/test/blob_test.dart');
final oid = repo.createBlobFromDisk(outsideFile.path); final oid = repo.createBlobFromDisk(outsideFile.path);
@ -156,7 +155,7 @@ void main() {
); );
}); });
group('diff', () { group('patch', () {
const path = 'feature_file'; const path = 'feature_file';
const blobPatch = """ const blobPatch = """
diff --git a/feature_file b/feature_file diff --git a/feature_file b/feature_file
@ -174,7 +173,7 @@ index e69de29..0000000
--- a/feature_file --- a/feature_file
+++ /dev/null +++ /dev/null
"""; """;
test('successfully creates from blobs', () { test('creates patch with changes between blobs', () {
final a = repo.lookupBlob( final a = repo.lookupBlob(
repo['e69de29bb2d1d6434b8b29ae775ad8c2e48c5391'], repo['e69de29bb2d1d6434b8b29ae775ad8c2e48c5391'],
); );
@ -195,7 +194,8 @@ index e69de29..0000000
b.free(); b.free();
}); });
test('successfully creates from one blob (delete)', () { test('creates patch with changes between blobs from one blob (delete)',
() {
final blob = repo.lookupBlob( final blob = repo.lookupBlob(
repo['e69de29bb2d1d6434b8b29ae775ad8c2e48c5391'], repo['e69de29bb2d1d6434b8b29ae775ad8c2e48c5391'],
); );
@ -211,7 +211,7 @@ index e69de29..0000000
patch.free(); patch.free();
}); });
test('successfully creates from blob and buffer', () { test('creates patch with changes between blob and buffer', () {
final blob = repo.lookupBlob( final blob = repo.lookupBlob(
repo['e69de29bb2d1d6434b8b29ae775ad8c2e48c5391'], repo['e69de29bb2d1d6434b8b29ae775ad8c2e48c5391'],
); );
@ -226,7 +226,7 @@ index e69de29..0000000
blob.free(); blob.free();
}); });
test('successfully creates from blob and buffer (delete)', () { test('creates patch with changes between blob and buffer (delete)', () {
final a = repo.lookupBlob( final a = repo.lookupBlob(
repo['e69de29bb2d1d6434b8b29ae775ad8c2e48c5391'], repo['e69de29bb2d1d6434b8b29ae775ad8c2e48c5391'],
); );

View file

@ -157,7 +157,7 @@ void main() {
branch.free(); branch.free();
}); });
test('successfully sets upstream of a branch', () { test('sets upstream of a branch', () {
final branch = repo.lookupBranch(name: 'master'); final branch = repo.lookupBranch(name: 'master');
var upstream = branch.upstream; var upstream = branch.upstream;
expect(upstream.name, 'refs/remotes/origin/master'); expect(upstream.name, 'refs/remotes/origin/master');
@ -176,7 +176,7 @@ void main() {
branch.free(); branch.free();
}); });
test('successfully unsets upstream of a branch', () { test('unsets upstream of a branch', () {
final branch = repo.lookupBranch(name: 'master'); final branch = repo.lookupBranch(name: 'master');
final upstream = branch.upstream; final upstream = branch.upstream;
expect(upstream.name, 'refs/remotes/origin/master'); expect(upstream.name, 'refs/remotes/origin/master');
@ -235,7 +235,7 @@ void main() {
}); });
group('create()', () { group('create()', () {
test('successfully creates', () { test('creates branch', () {
final commit = repo.lookupCommit(lastCommit); final commit = repo.lookupCommit(lastCommit);
final branch = repo.createBranch(name: 'testing', target: commit); final branch = repo.createBranch(name: 'testing', target: commit);
@ -262,7 +262,7 @@ void main() {
commit.free(); commit.free();
}); });
test('successfully creates with force flag when name already exists', () { test('creates branch with force flag when name already exists', () {
final commit = repo.lookupCommit(lastCommit); final commit = repo.lookupCommit(lastCommit);
final branch = repo.createBranch( final branch = repo.createBranch(
@ -284,7 +284,7 @@ void main() {
}); });
group('delete()', () { group('delete()', () {
test('successfully deletes', () { test('deletes branch', () {
repo.deleteBranch('feature'); repo.deleteBranch('feature');
expect( expect(
@ -302,7 +302,7 @@ void main() {
}); });
group('rename()', () { group('rename()', () {
test('successfully renames', () { test('renames branch', () {
repo.renameBranch(oldName: 'feature', newName: 'renamed'); repo.renameBranch(oldName: 'feature', newName: 'renamed');
final branch = repo.lookupBranch(name: 'renamed'); final branch = repo.lookupBranch(name: 'renamed');
final branches = repo.branches; final branches = repo.branches;
@ -327,7 +327,7 @@ void main() {
); );
}); });
test('successfully renames with force flag when name already exists', () { test('renames branch with force flag when name already exists', () {
repo.renameBranch( repo.renameBranch(
oldName: 'master', oldName: 'master',
newName: 'feature', newName: 'feature',

View file

@ -20,7 +20,7 @@ void main() {
}); });
group('Checkout', () { group('Checkout', () {
test('successfully checkouts head', () { test('checkouts head', () {
repo.reset(oid: repo['821ed6e'], resetType: GitReset.hard); repo.reset(oid: repo['821ed6e'], resetType: GitReset.hard);
expect(repo.status, isEmpty); expect(repo.status, isEmpty);
File('${tmpDir.path}/feature_file').writeAsStringSync('edit'); File('${tmpDir.path}/feature_file').writeAsStringSync('edit');
@ -46,7 +46,7 @@ void main() {
); );
}); });
test('successfully checkouts index', () { test('checkouts index', () {
File('${repo.workdir}feature_file').writeAsStringSync('edit'); File('${repo.workdir}feature_file').writeAsStringSync('edit');
expect(repo.status, contains('feature_file')); expect(repo.status, contains('feature_file'));
@ -69,7 +69,7 @@ void main() {
); );
}); });
test('successfully checkouts tree', () { test('checkouts tree', () {
final masterHead = repo.lookupCommit( final masterHead = repo.lookupCommit(
repo['821ed6e80627b8769d170a293862f9fc60825226'], repo['821ed6e80627b8769d170a293862f9fc60825226'],
); );
@ -111,7 +111,7 @@ void main() {
); );
}); });
test('successfully checkouts with alrenative directory', () { test('checkouts with alrenative directory', () {
final altDir = Directory('${Directory.systemTemp.path}/alt_dir'); final altDir = Directory('${Directory.systemTemp.path}/alt_dir');
// making sure there is no directory // making sure there is no directory
if (altDir.existsSync()) { if (altDir.existsSync()) {
@ -126,7 +126,7 @@ void main() {
altDir.deleteSync(recursive: true); altDir.deleteSync(recursive: true);
}); });
test('successfully checkouts file with provided path', () { test('checkouts file with provided path', () {
expect(repo.status, isEmpty); expect(repo.status, isEmpty);
repo.checkout( repo.checkout(
refName: 'refs/heads/feature', refName: 'refs/heads/feature',
@ -140,7 +140,7 @@ void main() {
); );
}); });
test('successfully performs dry run checkout', () { test('performs dry run checkout', () {
final index = repo.index; final index = repo.index;
expect(index.length, 4); expect(index.length, 4);
expect(File('${repo.workdir}/another_feature_file').existsSync(), false); expect(File('${repo.workdir}/another_feature_file').existsSync(), false);

View file

@ -44,7 +44,7 @@ void main() {
}); });
group('Commit', () { group('Commit', () {
test('successfully lookups for provided oid', () { test('lookups commit for provided oid', () {
final commit = repo.lookupCommit(tip); final commit = repo.lookupCommit(tip);
expect(commit, isA<Commit>()); expect(commit, isA<Commit>());
commit.free(); commit.free();
@ -63,7 +63,7 @@ void main() {
expect(() => Commit(nullptr).summary, throwsA(isA<LibGit2Error>())); expect(() => Commit(nullptr).summary, throwsA(isA<LibGit2Error>()));
}); });
test('successfully reverts commit', () { test('reverts commit affecting index and workdir', () {
final commit = repo.lookupCommit( final commit = repo.lookupCommit(
repo['821ed6e80627b8769d170a293862f9fc60825226'], repo['821ed6e80627b8769d170a293862f9fc60825226'],
); );
@ -83,7 +83,7 @@ void main() {
expect(() => repo.revert(Commit(nullptr)), throwsA(isA<LibGit2Error>())); expect(() => repo.revert(Commit(nullptr)), throwsA(isA<LibGit2Error>()));
}); });
test('successfully reverts commit to provided commit', () { test('reverts commit to provided commit', () {
final to = repo.lookupCommit( final to = repo.lookupCommit(
repo['78b8bf123e3952c970ae5c1ce0a3ea1d1336f6e8'], repo['78b8bf123e3952c970ae5c1ce0a3ea1d1336f6e8'],
); );
@ -115,7 +115,7 @@ void main() {
); );
}); });
test('successfully creates commit', () { test('creates commit', () {
final parent = repo.lookupCommit(tip); final parent = repo.lookupCommit(tip);
final oid = repo.createCommit( final oid = repo.createCommit(
updateRef: 'HEAD', updateRef: 'HEAD',
@ -174,7 +174,7 @@ Some description.
parent.free(); parent.free();
}); });
test('successfully creates commit without parents', () { test('creates commit without parents', () {
final oid = repo.createCommit( final oid = repo.createCommit(
updateRef: 'refs/heads/new', updateRef: 'refs/heads/new',
message: message, message: message,
@ -198,7 +198,7 @@ Some description.
commit.free(); commit.free();
}); });
test('successfully creates commit with 2 parents', () { test('creates commit with 2 parents', () {
final parent1 = repo.lookupCommit(tip); final parent1 = repo.lookupCommit(tip);
final parent2 = repo.lookupCommit( final parent2 = repo.lookupCommit(
repo['fc38877b2552ab554752d9a77e1f48f738cca79b'], repo['fc38877b2552ab554752d9a77e1f48f738cca79b'],
@ -272,7 +272,7 @@ Some description.
parent.free(); parent.free();
}); });
test('successfully amends commit with default arguments', () { test('amends commit with default arguments', () {
final oldHead = repo.head; final oldHead = repo.head;
final commit = repo.lookupCommit(repo['821ed6e']); final commit = repo.lookupCommit(repo['821ed6e']);
expect(commit.oid, oldHead.target); expect(commit.oid, oldHead.target);
@ -298,7 +298,7 @@ Some description.
oldHead.free(); oldHead.free();
}); });
test('successfully amends commit with provided arguments', () { test('amends commit with provided arguments', () {
final oldHead = repo.head; final oldHead = repo.head;
final commit = repo.lookupCommit(repo['821ed6e']); final commit = repo.lookupCommit(repo['821ed6e']);
expect(commit.oid, oldHead.target); expect(commit.oid, oldHead.target);
@ -327,7 +327,7 @@ Some description.
oldHead.free(); oldHead.free();
}); });
test('successfully amends commit that is not the tip of the branch', () { test('amends commit that is not the tip of the branch', () {
final head = repo.head; final head = repo.head;
final commit = repo.lookupCommit(repo['78b8bf1']); final commit = repo.lookupCommit(repo['78b8bf1']);
expect(commit.oid, isNot(head.target)); expect(commit.oid, isNot(head.target));

View file

@ -37,7 +37,7 @@ void main() {
}); });
group('Config', () { group('Config', () {
test('successfully opens file with provided path', () { test('opens file with provided path', () {
expect(config, isA<Config>()); expect(config, isA<Config>());
}); });
@ -57,7 +57,7 @@ void main() {
expect(() => Config.open('not.there'), throwsA(isA<Exception>())); expect(() => Config.open('not.there'), throwsA(isA<Exception>()));
}); });
test('successfully opens system file or throws is there is none', () { test('opens system file or throws is there is none', () {
try { try {
final config = Config.system(); final config = Config.system();
expect(config, isA<Config>()); expect(config, isA<Config>());
@ -67,7 +67,7 @@ void main() {
} }
}); });
test('successfully opens global file or throws is there is none', () { test('opens global file or throws is there is none', () {
try { try {
final config = Config.global(); final config = Config.global();
expect(config, isA<Config>()); expect(config, isA<Config>());
@ -77,7 +77,7 @@ void main() {
} }
}); });
test('successfully opens xdg file or throws is there is none', () { test('opens xdg file or throws is there is none', () {
try { try {
final config = Config.xdg(); final config = Config.xdg();
expect(config, isA<Config>()); expect(config, isA<Config>());
@ -141,7 +141,7 @@ void main() {
}); });
group('delete', () { group('delete', () {
test('successfully deletes entry', () { test('deletes entry', () {
expect(config['core.bare'].value, 'false'); expect(config['core.bare'].value, 'false');
config.delete('core.bare'); config.delete('core.bare');
expect(() => config['core.bare'], throwsA(isA<LibGit2Error>())); expect(() => config['core.bare'], throwsA(isA<LibGit2Error>()));
@ -195,7 +195,7 @@ void main() {
}); });
group('deleteMultivar()', () { group('deleteMultivar()', () {
test('successfully deletes value of a multivar', () { test('deletes value of a multivar', () {
expect( expect(
config.multivar( config.multivar(
variable: 'core.gitproxy', variable: 'core.gitproxy',

View file

@ -18,7 +18,7 @@ void main() {
} }
}); });
group('Credentials', () { group('Credentials', () {
test('successfully initializes username/password credentials', () { test('initializes username/password credentials', () {
final credentials = const UserPass( final credentials = const UserPass(
username: 'user', username: 'user',
password: 'password', password: 'password',
@ -31,7 +31,7 @@ void main() {
expect(credentials.toString(), contains('UserPass{')); expect(credentials.toString(), contains('UserPass{'));
}); });
test('successfully initializes keypair credentials', () { test('initializes keypair credentials', () {
final credentials = const Keypair( final credentials = const Keypair(
username: 'user', username: 'user',
pubKey: 'id_rsa.pub', pubKey: 'id_rsa.pub',
@ -48,7 +48,7 @@ void main() {
expect(credentials.toString(), contains('Keypair{')); expect(credentials.toString(), contains('Keypair{'));
}); });
test('successfully initializes keypair from memory credentials', () { test('initializes keypair from memory credentials', () {
final credentials = const KeypairFromMemory( final credentials = const KeypairFromMemory(
username: 'user', username: 'user',
pubKey: 'pubkey data', pubKey: 'pubkey data',
@ -65,7 +65,7 @@ void main() {
expect(credentials.toString(), contains('KeypairFromMemory{')); expect(credentials.toString(), contains('KeypairFromMemory{'));
}); });
test('successfully initializes keypair from agent credentials', () { test('initializes keypair from agent credentials', () {
final credentials = const KeypairFromAgent('user'); final credentials = const KeypairFromAgent('user');
expect(credentials, isA<Credentials>()); expect(credentials, isA<Credentials>());
@ -92,7 +92,7 @@ void main() {
); );
}); });
test('sucessfully clones repository with provided keypair', () { test('clones repository with provided keypair', () {
final keypair = const Keypair( final keypair = const Keypair(
username: 'git', username: 'git',
pubKey: 'test/assets/keys/id_rsa.pub', pubKey: 'test/assets/keys/id_rsa.pub',
@ -178,7 +178,7 @@ void main() {
); );
}); });
test('sucessfully clones repository with provided keypair from memory', () { test('clones repository with provided keypair from memory', () {
final pubKey = File('test/assets/keys/id_rsa.pub').readAsStringSync(); final pubKey = File('test/assets/keys/id_rsa.pub').readAsStringSync();
final privateKey = File('test/assets/keys/id_rsa').readAsStringSync(); final privateKey = File('test/assets/keys/id_rsa').readAsStringSync();
final keypair = KeypairFromMemory( final keypair = KeypairFromMemory(

View file

@ -21,7 +21,7 @@ void main() {
}); });
group('Describe', () { group('Describe', () {
test('successfully describes with default arguments', () { test('describes worktree with default arguments', () {
expect(repo.describe(), 'v0.2'); expect(repo.describe(), 'v0.2');
}); });
@ -30,7 +30,7 @@ void main() {
expect(() => nullRepo.describe(), throwsA(isA<LibGit2Error>())); expect(() => nullRepo.describe(), throwsA(isA<LibGit2Error>()));
}); });
test('successfully describes commit', () { test('describes commit', () {
repo.deleteTag('v0.2'); repo.deleteTag('v0.2');
expect( expect(
@ -54,7 +54,7 @@ void main() {
commit.free(); commit.free();
}); });
test('successfully describes with provided strategy', () { test('describes with provided strategy', () {
final commit = repo.lookupCommit(repo['5aecfa0']); final commit = repo.lookupCommit(repo['5aecfa0']);
expect( expect(
repo.describe( repo.describe(
@ -66,7 +66,7 @@ void main() {
commit.free(); commit.free();
}); });
test('successfully describes with provided pattern', () { test('describes with provided pattern', () {
final signature = Signature.create( final signature = Signature.create(
name: 'Author', name: 'Author',
email: 'author@email.com', email: 'author@email.com',
@ -90,7 +90,7 @@ void main() {
signature.free(); signature.free();
}); });
test('successfully describes and follows first parent only', () { test('describes and follows first parent only', () {
final commit = repo.lookupCommit(repo['821ed6e']); final commit = repo.lookupCommit(repo['821ed6e']);
repo.deleteTag('v0.2'); repo.deleteTag('v0.2');
@ -106,7 +106,7 @@ void main() {
commit.free(); commit.free();
}); });
test('successfully describes with provided abbreviated size', () { test('describes with provided abbreviated size', () {
final commit = repo.lookupCommit(repo['821ed6e']); final commit = repo.lookupCommit(repo['821ed6e']);
repo.deleteTag('v0.2'); repo.deleteTag('v0.2');
@ -131,11 +131,11 @@ void main() {
commit.free(); commit.free();
}); });
test('successfully describes with long format', () { test('describes with long format', () {
expect(repo.describe(alwaysUseLongFormat: true), 'v0.2-0-g821ed6e'); expect(repo.describe(alwaysUseLongFormat: true), 'v0.2-0-g821ed6e');
}); });
test('successfully describes and appends dirty suffix', () { test('describes and appends dirty suffix', () {
final index = repo.index; final index = repo.index;
index.clear(); index.clear();
@ -144,7 +144,7 @@ void main() {
index.free(); index.free();
}); });
test('successfully describes with max candidates tags flag set', () { test('describes with max candidates tags flag set', () {
final index = repo.index; final index = repo.index;
index.clear(); index.clear();

View file

@ -102,7 +102,7 @@ index e69de29..c217c63 100644
}); });
group('Diff', () { group('Diff', () {
test('successfully returns diff between index and workdir', () { test('returns diff between index and workdir', () {
final index = repo.index; final index = repo.index;
final diff = repo.diff(); final diff = repo.diff();
@ -115,7 +115,7 @@ index e69de29..c217c63 100644
index.free(); index.free();
}); });
test('successfully returns diff between index and tree', () { test('returns diff between index and tree', () {
final index = repo.index; final index = repo.index;
final head = repo.head; final head = repo.head;
final commit = repo.lookupCommit(head.target); final commit = repo.lookupCommit(head.target);
@ -141,7 +141,7 @@ index e69de29..c217c63 100644
index.free(); index.free();
}); });
test('successfully returns diff between tree and workdir', () { test('returns diff between tree and workdir', () {
final head = repo.head; final head = repo.head;
final commit = repo.lookupCommit(head.target); final commit = repo.lookupCommit(head.target);
final tree = commit.tree; final tree = commit.tree;
@ -165,7 +165,7 @@ index e69de29..c217c63 100644
expect(() => nullRepo.diff(a: nullTree), throwsA(isA<LibGit2Error>())); expect(() => nullRepo.diff(a: nullTree), throwsA(isA<LibGit2Error>()));
}); });
test('successfully returns diff between tree and index', () { test('returns diff between tree and index', () {
final index = repo.index; final index = repo.index;
final head = repo.head; final head = repo.head;
final commit = repo.lookupCommit(head.target); final commit = repo.lookupCommit(head.target);
@ -184,7 +184,7 @@ index e69de29..c217c63 100644
index.free(); index.free();
}); });
test('successfully returns diff between tree and tree', () { test('returns diff between tree and tree', () {
final head = repo.head; final head = repo.head;
final commit = repo.lookupCommit(head.target); final commit = repo.lookupCommit(head.target);
final tree1 = commit.tree; final tree1 = commit.tree;
@ -236,7 +236,7 @@ index e69de29..c217c63 100644
head.free(); head.free();
}); });
test('successfully merges diffs', () { test('merges diffs', () {
final head = repo.head; final head = repo.head;
final commit = repo.lookupCommit(head.target); final commit = repo.lookupCommit(head.target);
final tree1 = commit.tree; final tree1 = commit.tree;
@ -260,7 +260,7 @@ index e69de29..c217c63 100644
diff2.free(); diff2.free();
}); });
test('successfully parses provided diff', () { test('parses provided diff', () {
final diff = Diff.parse(patchText); final diff = Diff.parse(patchText);
final stats = diff.stats; final stats = diff.stats;
@ -316,7 +316,7 @@ index e69de29..c217c63 100644
diff2.free(); diff2.free();
}); });
test('successfully applies diff to repository', () { test('applies diff to repository', () {
final diff = Diff.parse(patchText); final diff = Diff.parse(patchText);
final file = File('${tmpDir.path}/subdir/modified_file'); final file = File('${tmpDir.path}/subdir/modified_file');
@ -334,7 +334,7 @@ index e69de29..c217c63 100644
expect(() => repo.apply(diff: nullDiff), throwsA(isA<LibGit2Error>())); expect(() => repo.apply(diff: nullDiff), throwsA(isA<LibGit2Error>()));
}); });
test('successfully creates patch from entry index in diff', () { test('creates patch from entry index in diff', () {
final diff = Diff.parse(patchText); final diff = Diff.parse(patchText);
final patch = Patch.fromDiff(diff: diff, index: 0); final patch = Patch.fromDiff(diff: diff, index: 0);
@ -345,7 +345,7 @@ index e69de29..c217c63 100644
diff.free(); diff.free();
}); });
test('successfully applies hunk with provided index to repository', () { test('applies hunk with provided index to repository', () {
final diff = Diff.parse(patchText); final diff = Diff.parse(patchText);
final hunk = diff.patches.first.hunks.first; final hunk = diff.patches.first.hunks.first;
final file = File('${tmpDir.path}/subdir/modified_file'); final file = File('${tmpDir.path}/subdir/modified_file');
@ -359,7 +359,7 @@ index e69de29..c217c63 100644
diff.free(); diff.free();
}); });
test('successfully applies diff to tree', () { test('applies diff to tree', () {
final diff = Diff.parse(patchText); final diff = Diff.parse(patchText);
repo.checkout(refName: 'HEAD', strategy: {GitCheckout.force}); repo.checkout(refName: 'HEAD', strategy: {GitCheckout.force});
@ -385,7 +385,7 @@ index e69de29..c217c63 100644
diff.free(); diff.free();
}); });
test('successfully applies hunk with provided index to tree', () { test('applies hunk with provided index to tree', () {
final diff = Diff.parse(patchText); final diff = Diff.parse(patchText);
final hunk = diff.patches.first.hunks.first; final hunk = diff.patches.first.hunks.first;
@ -425,7 +425,7 @@ index e69de29..c217c63 100644
}); });
}); });
test('successfully finds similar entries', () { test('finds similar entries', () {
final index = repo.index; final index = repo.index;
final head = repo.head; final head = repo.head;
final commit = repo.lookupCommit(head.target); final commit = repo.lookupCommit(head.target);

View file

@ -36,7 +36,7 @@ void main() {
expect(index.capabilities, isEmpty); expect(index.capabilities, isEmpty);
}); });
test('successfully sets index capabilities', () { test('sets index capabilities', () {
expect(index.capabilities, isEmpty); expect(index.capabilities, isEmpty);
index.capabilities = { index.capabilities = {
@ -90,7 +90,7 @@ void main() {
expect(() => index[10], throwsA(isA<ArgumentError>())); expect(() => index[10], throwsA(isA<ArgumentError>()));
}); });
test('successfully changes attributes', () { test('changes attributes', () {
final entry = index['file']; final entry = index['file'];
final otherEntry = index['feature_file']; final otherEntry = index['feature_file'];
@ -117,7 +117,7 @@ void main() {
}); });
group('add()', () { group('add()', () {
test('successfully adds with provided IndexEntry', () { test('adds with provided IndexEntry', () {
final entry = index['file']; final entry = index['file'];
index.add(entry); index.add(entry);
@ -125,7 +125,7 @@ void main() {
expect(index.length, 4); expect(index.length, 4);
}); });
test('successfully adds with provided path string', () { test('adds with provided path string', () {
index.add('file'); index.add('file');
expect(index['file'].oid.sha, fileSha); expect(index['file'].oid.sha, fileSha);
expect(index.length, 4); expect(index.length, 4);
@ -154,7 +154,7 @@ void main() {
}); });
group('addFromBuffer()', () { group('addFromBuffer()', () {
test('successfully updates index entry from a buffer', () { test('updates index entry from a buffer', () {
final entry = index['file']; final entry = index['file'];
expect(repo.status, isEmpty); expect(repo.status, isEmpty);
@ -174,7 +174,7 @@ void main() {
}); });
group('addAll()', () { group('addAll()', () {
test('successfully adds with provided pathspec', () { test('adds with provided pathspec', () {
index.clear(); index.clear();
index.addAll(['file', 'feature_file']); index.addAll(['file', 'feature_file']);
@ -208,7 +208,7 @@ void main() {
}); });
group('updateAll()', () { group('updateAll()', () {
test('successfully updates all entries to match working directory', () { test('updates all entries to match working directory', () {
expect(repo.status, isEmpty); expect(repo.status, isEmpty);
File('${repo.workdir}file').deleteSync(); File('${repo.workdir}file').deleteSync();
File('${repo.workdir}feature_file').deleteSync(); File('${repo.workdir}feature_file').deleteSync();
@ -279,7 +279,7 @@ void main() {
expect(index.length, 4); expect(index.length, 4);
}); });
test('successfully reads tree with provided SHA hex', () { test('reads tree with provided SHA hex', () {
final tree = repo.lookupTree( final tree = repo.lookupTree(
repo['df2b8fc99e1c1d4dbc0a854d9f72157f1d6ea078'], repo['df2b8fc99e1c1d4dbc0a854d9f72157f1d6ea078'],
); );
@ -293,7 +293,7 @@ void main() {
expect(index.length, 4); expect(index.length, 4);
}); });
test('successfully writes tree', () { test('writes tree', () {
final oid = index.writeTree(); final oid = index.writeTree();
expect(oid.sha, 'a8ae3dd59e6e1802c6f78e05e301bfd57c9f334f'); expect(oid.sha, 'a8ae3dd59e6e1802c6f78e05e301bfd57c9f334f');
}); });
@ -327,7 +327,7 @@ void main() {
tmpDir.deleteSync(recursive: true); tmpDir.deleteSync(recursive: true);
}); });
test('successfully adds conflict entry', () { test('adds conflict entry', () {
expect(index.conflicts, isEmpty); expect(index.conflicts, isEmpty);
index.addConflict( index.addConflict(
ourEntry: index['file'], ourEntry: index['file'],
@ -454,7 +454,7 @@ void main() {
repoDir.deleteSync(recursive: true); repoDir.deleteSync(recursive: true);
}); });
test('successfully removes conflict', () { test('removes conflict', () {
final repoDir = setupRepo(Directory('test/assets/merge_repo/')); final repoDir = setupRepo(Directory('test/assets/merge_repo/'));
final conflictRepo = Repository.open(repoDir.path); final conflictRepo = Repository.open(repoDir.path);
@ -492,7 +492,7 @@ void main() {
); );
}); });
test('successfully removes all conflicts', () { test('removes all conflicts', () {
final repoDir = setupRepo(Directory('test/assets/merge_repo/')); final repoDir = setupRepo(Directory('test/assets/merge_repo/'));
final conflictRepo = Repository.open(repoDir.path); final conflictRepo = Repository.open(repoDir.path);

View file

@ -140,14 +140,14 @@ Santa Claus <santa.claus@northpole.xx> <me@company.xx>
}); });
group('Mailmap', () { group('Mailmap', () {
test('successfully initializes', () { test('initializes empty mailmap object', () {
final empty = Mailmap.empty(); final empty = Mailmap.empty();
expect(empty, isA<Mailmap>()); expect(empty, isA<Mailmap>());
empty.free(); empty.free();
}); });
test('successfully initializes from provided buffer', () { test('initializes from provided buffer', () {
final mailmap = Mailmap.fromBuffer(testMailmap); final mailmap = Mailmap.fromBuffer(testMailmap);
expect(mailmap, isA<Mailmap>()); expect(mailmap, isA<Mailmap>());
@ -161,7 +161,7 @@ Santa Claus <santa.claus@northpole.xx> <me@company.xx>
mailmap.free(); mailmap.free();
}); });
test('successfully initializes from repository', () { test('initializes from repository', () {
final mailmap = Mailmap.fromRepository(repo); final mailmap = Mailmap.fromRepository(repo);
expect(mailmap, isA<Mailmap>()); expect(mailmap, isA<Mailmap>());
@ -182,7 +182,7 @@ Santa Claus <santa.claus@northpole.xx> <me@company.xx>
); );
}); });
test('successfully resolves names and emails when mailmap is empty', () { test('resolves names and emails when mailmap is empty', () {
final mailmap = Mailmap.empty(); final mailmap = Mailmap.empty();
for (final entry in testResolve) { for (final entry in testResolve) {
@ -195,7 +195,7 @@ Santa Claus <santa.claus@northpole.xx> <me@company.xx>
mailmap.free(); mailmap.free();
}); });
test('successfully adds entries and resolves them', () { test('adds entries and resolves them', () {
final mailmap = Mailmap.empty(); final mailmap = Mailmap.empty();
for (final entry in testEntries) { for (final entry in testEntries) {
@ -230,7 +230,7 @@ Santa Claus <santa.claus@northpole.xx> <me@company.xx>
mailmap.free(); mailmap.free();
}); });
test('successfully resolves signature', () { test('resolves signature', () {
final signature = Signature.create( final signature = Signature.create(
name: 'nick1', name: 'nick1',
email: 'bugs@company.xx', email: 'bugs@company.xx',

View file

@ -301,7 +301,7 @@ theirs content
}); });
group('merge commits', () { group('merge commits', () {
test('successfully merges with default values', () { test('merges with default values', () {
final theirCommit = repo.lookupCommit(repo['5aecfa0']); final theirCommit = repo.lookupCommit(repo['5aecfa0']);
final theirCommitAnnotated = AnnotatedCommit.lookup( final theirCommitAnnotated = AnnotatedCommit.lookup(
repo: repo, repo: repo,
@ -330,7 +330,7 @@ theirs content
theirCommit.free(); theirCommit.free();
}); });
test('successfully merges with provided favor', () { test('merges with provided favor', () {
final theirCommit = repo.lookupCommit(repo['5aecfa0']); final theirCommit = repo.lookupCommit(repo['5aecfa0']);
final ourCommit = repo.lookupCommit(repo['1490545']); final ourCommit = repo.lookupCommit(repo['1490545']);
@ -346,7 +346,7 @@ theirs content
theirCommit.free(); theirCommit.free();
}); });
test('successfully merges with provided merge and file flags', () { test('merges with provided merge and file flags', () {
final theirCommit = repo.lookupCommit(repo['5aecfa0']); final theirCommit = repo.lookupCommit(repo['5aecfa0']);
final ourCommit = repo.lookupCommit(repo['1490545']); final ourCommit = repo.lookupCommit(repo['1490545']);
@ -452,7 +452,7 @@ theirs content
}); });
group('merge trees', () { group('merge trees', () {
test('successfully merges with default values', () { test('merges with default values', () {
final theirCommit = repo.lookupCommit(repo['5aecfa0']); final theirCommit = repo.lookupCommit(repo['5aecfa0']);
final theirCommitAnnotated = AnnotatedCommit.lookup( final theirCommitAnnotated = AnnotatedCommit.lookup(
repo: repo, repo: repo,
@ -493,7 +493,7 @@ theirs content
theirCommit.free(); theirCommit.free();
}); });
test('successfully merges with provided favor', () { test('merges with provided favor', () {
final theirCommit = repo.lookupCommit(repo['5aecfa0']); final theirCommit = repo.lookupCommit(repo['5aecfa0']);
final ourCommit = repo.lookupCommit(repo['1490545']); final ourCommit = repo.lookupCommit(repo['1490545']);
final baseCommit = repo.lookupCommit( final baseCommit = repo.lookupCommit(
@ -532,7 +532,7 @@ theirs content
}); });
}); });
test('successfully cherry-picks commit', () { test('cherry-picks commit', () {
final cherry = repo.lookupCommit(repo['5aecfa0']); final cherry = repo.lookupCommit(repo['5aecfa0']);
repo.cherryPick(cherry); repo.cherryPick(cherry);
expect(repo.state, GitRepositoryState.cherrypick); expect(repo.state, GitRepositoryState.cherrypick);

View file

@ -51,7 +51,7 @@ void main() {
expect(() => repo.notes, throwsA(isA<LibGit2Error>())); expect(() => repo.notes, throwsA(isA<LibGit2Error>()));
}); });
test('successfully lookups note', () { test('lookups note', () {
final head = repo.head; final head = repo.head;
final note = repo.lookupNote(annotatedOid: head.target); final note = repo.lookupNote(annotatedOid: head.target);
@ -63,7 +63,7 @@ void main() {
head.free(); head.free();
}); });
test('successfully creates note', () { test('creates note', () {
final signature = Signature.create( final signature = Signature.create(
name: 'Author', name: 'Author',
email: 'author@email.com', email: 'author@email.com',
@ -99,7 +99,7 @@ void main() {
); );
}); });
test('successfully deletes note', () { test('deletes note', () {
final signature = Signature.create( final signature = Signature.create(
name: 'Author', name: 'Author',
email: 'author@email.com', email: 'author@email.com',

View file

@ -34,13 +34,13 @@ void main() {
expect(() => Repository((nullptr)).odb, throwsA(isA<LibGit2Error>())); expect(() => Repository((nullptr)).odb, throwsA(isA<LibGit2Error>()));
}); });
test('successfully creates new odb with no backends', () { test('creates new odb with no backends', () {
final odb = Odb.create(); final odb = Odb.create();
expect(odb, isA<Odb>()); expect(odb, isA<Odb>());
odb.free(); odb.free();
}); });
test('successfully adds disk alternate', () { test('adds disk alternate', () {
final odb = Odb.create(); final odb = Odb.create();
odb.addDiskAlternate('${repo.workdir}.git/objects/'); odb.addDiskAlternate('${repo.workdir}.git/objects/');
@ -49,7 +49,7 @@ void main() {
odb.free(); odb.free();
}); });
test('successfully reads object', () { test('reads object', () {
final oid = repo[blobSha]; final oid = repo[blobSha];
final odb = repo.odb; final odb = repo.odb;
final object = odb.read(oid); final object = odb.read(oid);
@ -95,7 +95,7 @@ void main() {
odb.free(); odb.free();
}); });
test('successfully writes data', () { test('writes data', () {
final odb = repo.odb; final odb = repo.odb;
final oid = odb.write(type: GitObject.blob, data: 'testing'); final oid = odb.write(type: GitObject.blob, data: 'testing');
final object = odb.read(oid); final object = odb.read(oid);

View file

@ -25,13 +25,13 @@ void main() {
group('Oid', () { group('Oid', () {
group('fromSHA()', () { group('fromSHA()', () {
test('successfully initializes', () { test('initializes from 40-char hex string', () {
final oid = Oid.fromSHA(repo: repo, sha: sha); final oid = Oid.fromSHA(repo: repo, sha: sha);
expect(oid, isA<Oid>()); expect(oid, isA<Oid>());
expect(oid.sha, sha); expect(oid.sha, sha);
}); });
test('successfully initializes from short hex string', () { test('initializes from short hex string', () {
final oid = Oid.fromSHA(repo: repo, sha: sha.substring(0, 5)); final oid = Oid.fromSHA(repo: repo, sha: sha.substring(0, 5));
expect(oid, isA<Oid>()); expect(oid, isA<Oid>());

View file

@ -54,7 +54,7 @@ index e69de29..0000000
}); });
group('Patch', () { group('Patch', () {
test('successfully creates from buffers', () { test('creates from buffers', () {
final patch = Patch.create( final patch = Patch.create(
a: oldBlob, a: oldBlob,
b: newBlob, b: newBlob,
@ -68,7 +68,7 @@ index e69de29..0000000
patch.free(); patch.free();
}); });
test('successfully creates from one buffer (add)', () { test('creates from one buffer (add)', () {
final patch = Patch.create( final patch = Patch.create(
a: null, a: null,
b: newBlob, b: newBlob,
@ -81,7 +81,7 @@ index e69de29..0000000
patch.free(); patch.free();
}); });
test('successfully creates from one buffer (delete)', () { test('creates from one buffer (delete)', () {
final patch = Patch.create( final patch = Patch.create(
a: oldBlob, a: oldBlob,
b: null, b: null,
@ -94,7 +94,7 @@ index e69de29..0000000
patch.free(); patch.free();
}); });
test('successfully creates from blobs', () { test('creates from blobs', () {
final a = repo.lookupBlob(oldBlobOid); final a = repo.lookupBlob(oldBlobOid);
final b = repo.lookupBlob(newBlobOid); final b = repo.lookupBlob(newBlobOid);
final patch = Patch.create( final patch = Patch.create(
@ -109,7 +109,7 @@ index e69de29..0000000
patch.free(); patch.free();
}); });
test('successfully creates from one blob (add)', () { test('creates from one blob (add)', () {
final b = repo.lookupBlob(newBlobOid); final b = repo.lookupBlob(newBlobOid);
final patch = Patch.create( final patch = Patch.create(
a: null, a: null,
@ -123,7 +123,7 @@ index e69de29..0000000
patch.free(); patch.free();
}); });
test('successfully creates from one blob (delete)', () { test('creates from one blob (delete)', () {
final a = repo.lookupBlob(oldBlobOid); final a = repo.lookupBlob(oldBlobOid);
final patch = Patch.create( final patch = Patch.create(
a: a, a: a,
@ -137,7 +137,7 @@ index e69de29..0000000
patch.free(); patch.free();
}); });
test('successfully creates from blob and buffer', () { test('creates from blob and buffer', () {
final a = repo.lookupBlob(oldBlobOid); final a = repo.lookupBlob(oldBlobOid);
final patch = Patch.create( final patch = Patch.create(
a: a, a: a,

View file

@ -25,7 +25,7 @@ void main() {
}); });
group('Rebase', () { group('Rebase', () {
test('successfully performs rebase when there is no conflicts', () { test('performs rebase when there is no conflicts', () {
final signature = Signature.create( final signature = Signature.create(
name: 'Author', name: 'Author',
email: 'author@email.com', email: 'author@email.com',
@ -83,7 +83,7 @@ void main() {
signature.free(); signature.free();
}); });
test('successfully performs rebase without branch provided', () { test('performs rebase without branch provided', () {
final signature = Signature.create( final signature = Signature.create(
name: 'Author', name: 'Author',
email: 'author@email.com', email: 'author@email.com',
@ -129,7 +129,7 @@ void main() {
signature.free(); signature.free();
}); });
test('successfully performs rebase with provided upstream', () { test('performs rebase with provided upstream', () {
final signature = Signature.create( final signature = Signature.create(
name: 'Author', name: 'Author',
email: 'author@email.com', email: 'author@email.com',
@ -250,7 +250,7 @@ void main() {
signature.free(); signature.free();
}); });
test('successfully aborts rebase in progress', () { test('aborts rebase in progress', () {
final master = repo.lookupReference('refs/heads/master'); final master = repo.lookupReference('refs/heads/master');
final branchHead = AnnotatedCommit.lookup(repo: repo, oid: master.target); final branchHead = AnnotatedCommit.lookup(repo: repo, oid: master.target);
final conflict = repo.lookupReference('refs/heads/conflict-branch'); final conflict = repo.lookupReference('refs/heads/conflict-branch');

View file

@ -167,7 +167,7 @@ void main() {
}); });
group('create direct', () { group('create direct', () {
test('successfully creates with Oid as target', () { test('creates with oid as target', () {
final ref = repo.lookupReference('refs/heads/master'); final ref = repo.lookupReference('refs/heads/master');
final refFromOid = repo.createReference( final refFromOid = repo.createReference(
name: 'refs/tags/from.oid', name: 'refs/tags/from.oid',
@ -180,7 +180,7 @@ void main() {
ref.free(); ref.free();
}); });
test('successfully creates with log message', () { test('creates with log message', () {
repo.setIdentity(name: 'name', email: 'email'); repo.setIdentity(name: 'name', email: 'email');
final ref = repo.createReference( final ref = repo.createReference(
name: 'refs/heads/log.message', name: 'refs/heads/log.message',
@ -227,7 +227,7 @@ void main() {
); );
}); });
test('successfully creates with force flag if name already exists', () { test('creates with force flag if name already exists', () {
final ref = repo.createReference( final ref = repo.createReference(
name: 'refs/tags/test', name: 'refs/tags/test',
target: repo[lastCommit], target: repo[lastCommit],
@ -264,7 +264,7 @@ void main() {
}); });
group('create symbolic', () { group('create symbolic', () {
test('successfully creates with valid target', () { test('creates with valid target', () {
final ref = repo.createReference( final ref = repo.createReference(
name: 'refs/tags/symbolic', name: 'refs/tags/symbolic',
target: 'refs/heads/master', target: 'refs/heads/master',
@ -276,7 +276,7 @@ void main() {
ref.free(); ref.free();
}); });
test('successfully creates with force flag if name already exists', () { test('creates with force flag if name already exists', () {
final ref = repo.createReference( final ref = repo.createReference(
name: 'refs/tags/test', name: 'refs/tags/test',
target: 'refs/heads/master', target: 'refs/heads/master',
@ -322,7 +322,7 @@ void main() {
); );
}); });
test('successfully creates with log message', () { test('creates with log message', () {
repo.setIdentity(name: 'name', email: 'email'); repo.setIdentity(name: 'name', email: 'email');
final ref = repo.createReference( final ref = repo.createReference(
name: 'HEAD', name: 'HEAD',
@ -343,7 +343,7 @@ void main() {
}); });
}); });
test('successfully deletes reference', () { test('deletes reference', () {
expect(repo.references, contains('refs/tags/v0.1')); expect(repo.references, contains('refs/tags/v0.1'));
repo.deleteReference('refs/tags/v0.1'); repo.deleteReference('refs/tags/v0.1');
@ -375,7 +375,7 @@ void main() {
}); });
group('set target', () { group('set target', () {
test('successfully sets direct reference with provided Oid target', () { test('sets direct reference with provided oid target', () {
final ref = repo.lookupReference('refs/heads/master'); final ref = repo.lookupReference('refs/heads/master');
ref.setTarget(target: repo[newCommit]); ref.setTarget(target: repo[newCommit]);
expect(ref.target.sha, newCommit); expect(ref.target.sha, newCommit);
@ -383,8 +383,7 @@ void main() {
ref.free(); ref.free();
}); });
test('successfully sets symbolic target with provided reference name', test('sets symbolic target with provided reference name', () {
() {
final ref = repo.lookupReference('HEAD'); final ref = repo.lookupReference('HEAD');
expect(ref.target.sha, lastCommit); expect(ref.target.sha, lastCommit);
@ -394,7 +393,7 @@ void main() {
ref.free(); ref.free();
}); });
test('successfully sets target with log message', () { test('sets target with log message', () {
final ref = repo.lookupReference('HEAD'); final ref = repo.lookupReference('HEAD');
expect(ref.target.sha, lastCommit); expect(ref.target.sha, lastCommit);
@ -429,7 +428,7 @@ void main() {
}); });
group('rename', () { group('rename', () {
test('successfully renames reference', () { test('renames reference', () {
repo.renameReference( repo.renameReference(
oldName: 'refs/tags/v0.1', oldName: 'refs/tags/v0.1',
newName: 'refs/tags/renamed', newName: 'refs/tags/renamed',
@ -459,7 +458,7 @@ void main() {
); );
}); });
test('successfully renames with force flag set to true', () { test('renames with force flag set to true', () {
final ref1 = repo.lookupReference('refs/tags/v0.1'); final ref1 = repo.lookupReference('refs/tags/v0.1');
final ref2 = repo.lookupReference('refs/tags/v0.2'); final ref2 = repo.lookupReference('refs/tags/v0.2');
@ -501,7 +500,7 @@ void main() {
ref3.free(); ref3.free();
}); });
test('successfully peels to non-tag object when no type is provided', () { test('peels to non-tag object when no type is provided', () {
final ref = repo.lookupReference('refs/heads/master'); final ref = repo.lookupReference('refs/heads/master');
final commit = repo.lookupCommit(ref.target); final commit = repo.lookupCommit(ref.target);
final peeled = ref.peel() as Commit; final peeled = ref.peel() as Commit;
@ -513,7 +512,7 @@ void main() {
ref.free(); ref.free();
}); });
test('successfully peels to object of provided type', () { test('peels to object of provided type', () {
final ref = repo.lookupReference('refs/heads/master'); final ref = repo.lookupReference('refs/heads/master');
final blob = repo.lookupBlob(repo['9c78c21']); final blob = repo.lookupBlob(repo['9c78c21']);
final blobRef = repo.createReference( final blobRef = repo.createReference(
@ -550,7 +549,7 @@ void main() {
expect(() => Reference(nullptr).peel(), throwsA(isA<LibGit2Error>())); expect(() => Reference(nullptr).peel(), throwsA(isA<LibGit2Error>()));
}); });
test('successfully compresses references', () { test('compresses references', () {
final packedRefsFile = File('${tmpDir.path}/.git/packed-refs'); final packedRefsFile = File('${tmpDir.path}/.git/packed-refs');
expect(packedRefsFile.existsSync(), false); expect(packedRefsFile.existsSync(), false);
final oldRefs = repo.references; final oldRefs = repo.references;

View file

@ -47,7 +47,7 @@ void main() {
} }
}); });
test('fetch() successfully prunes branch with provided flag', () { test('fetch() prunes branch with provided flag', () {
remote.fetch(prune: GitFetchPrune.prune); remote.fetch(prune: GitFetchPrune.prune);
final branches = clonedRepo.branches; final branches = clonedRepo.branches;
@ -69,7 +69,7 @@ void main() {
} }
}); });
test('prune() successfully prunes branches', () { test('prune() prunes branches', () {
final pruned = <String>[]; final pruned = <String>[];
void updateTips(String refname, Oid oldOid, Oid newOid) { void updateTips(String refname, Oid oldOid, Oid newOid) {
pruned.add(refname); pruned.add(refname);

View file

@ -26,7 +26,7 @@ void main() {
expect(repo.remotes, ['origin']); expect(repo.remotes, ['origin']);
}); });
test('successfully looks up remote for provided name', () { test('lookups remote for provided name', () {
final remote = repo.lookupRemote('origin'); final remote = repo.lookupRemote('origin');
expect(remote.name, remoteName); expect(remote.name, remoteName);
@ -41,7 +41,7 @@ void main() {
expect(() => repo.lookupRemote('upstream'), throwsA(isA<LibGit2Error>())); expect(() => repo.lookupRemote('upstream'), throwsA(isA<LibGit2Error>()));
}); });
test('successfully creates without fetchspec', () { test('creates without fetchspec', () {
final remote = repo.createRemote(name: 'upstream', url: remoteUrl); final remote = repo.createRemote(name: 'upstream', url: remoteUrl);
expect(repo.remotes.length, 2); expect(repo.remotes.length, 2);
@ -52,7 +52,7 @@ void main() {
remote.free(); remote.free();
}); });
test('successfully creates with provided fetchspec', () { test('creates with provided fetchspec', () {
const spec = '+refs/*:refs/*'; const spec = '+refs/*:refs/*';
final remote = repo.createRemote( final remote = repo.createRemote(
name: 'upstream', name: 'upstream',
@ -81,7 +81,7 @@ void main() {
); );
}); });
test('successfully deletes', () { test('deletes remote', () {
final remote = repo.createRemote(name: 'upstream', url: remoteUrl); final remote = repo.createRemote(name: 'upstream', url: remoteUrl);
expect(repo.remotes.length, 2); expect(repo.remotes.length, 2);
@ -98,7 +98,7 @@ void main() {
); );
}); });
test('successfully renames', () { test('renames remote', () {
final remote = repo.lookupRemote(remoteName); final remote = repo.lookupRemote(remoteName);
final problems = repo.renameRemote(oldName: remoteName, newName: 'new'); final problems = repo.renameRemote(oldName: remoteName, newName: 'new');
@ -134,7 +134,7 @@ void main() {
); );
}); });
test('successfully sets url', () { test('sets url', () {
final remote = repo.lookupRemote(remoteName); final remote = repo.lookupRemote(remoteName);
expect(remote.url, remoteUrl); expect(remote.url, remoteUrl);
@ -155,7 +155,7 @@ void main() {
); );
}); });
test('successfully sets url for pushing', () { test('sets url for pushing', () {
const newUrl = 'git://new/url.git'; const newUrl = 'git://new/url.git';
Remote.setPushUrl(repo: repo, remote: remoteName, url: newUrl); Remote.setPushUrl(repo: repo, remote: remoteName, url: newUrl);
@ -218,7 +218,7 @@ void main() {
remote.free(); remote.free();
}); });
test('successfully adds fetch refspec', () { test('adds fetch refspec', () {
Remote.addFetch( Remote.addFetch(
repo: repo, repo: repo,
remote: 'origin', remote: 'origin',
@ -248,7 +248,7 @@ void main() {
); );
}); });
test('successfully adds push refspec', () { test('adds push refspec', () {
Remote.addPush( Remote.addPush(
repo: repo, repo: repo,
remote: 'origin', remote: 'origin',
@ -272,7 +272,7 @@ void main() {
); );
}); });
test("successfully returns remote repo's reference list", () { test("returns remote repo's reference list", () {
Remote.setUrl( Remote.setUrl(
repo: repo, repo: repo,
remote: 'libgit2', remote: 'libgit2',
@ -305,7 +305,7 @@ void main() {
}); });
test( test(
'successfully fetches data', 'fetches data',
() { () {
Remote.setUrl( Remote.setUrl(
repo: repo, repo: repo,
@ -338,7 +338,7 @@ void main() {
); );
test( test(
'successfully fetches data with proxy set to auto', 'fetches data with proxy set to auto',
() { () {
Remote.setUrl( Remote.setUrl(
repo: repo, repo: repo,
@ -412,7 +412,7 @@ void main() {
}); });
test( test(
'successfully fetches data with provided transfer progress callback', 'fetches data with provided transfer progress callback',
() { () {
Remote.setUrl( Remote.setUrl(
repo: repo, repo: repo,
@ -441,7 +441,7 @@ void main() {
); );
test( test(
'successfully fetches data with provided sideband progress callback', 'fetches data with provided sideband progress callback',
() { () {
const sidebandMessage = """ const sidebandMessage = """
Enumerating objects: 69, done. Enumerating objects: 69, done.
@ -471,7 +471,7 @@ Total 69 (delta 0), reused 1 (delta 0), pack-reused 68
); );
test( test(
'successfully fetches data with provided update tips callback', 'fetches data with provided update tips callback',
() { () {
Remote.setUrl( Remote.setUrl(
repo: repo, repo: repo,
@ -516,7 +516,7 @@ Total 69 (delta 0), reused 1 (delta 0), pack-reused 68
tags: 'remote_fetch', tags: 'remote_fetch',
); );
test('successfully pushes with update reference callback', () { test('pushes with update reference callback', () {
final originDir = final originDir =
Directory('${Directory.systemTemp.path}/origin_testrepo'); Directory('${Directory.systemTemp.path}/origin_testrepo');

View file

@ -29,7 +29,7 @@ void main() {
}); });
group('Repository.clone', () { group('Repository.clone', () {
test('successfully clones repository', () { test('clones repository', () {
final clonedRepo = Repository.clone( final clonedRepo = Repository.clone(
url: tmpDir.path, url: tmpDir.path,
localPath: cloneDir.path, localPath: cloneDir.path,
@ -41,7 +41,7 @@ void main() {
clonedRepo.free(); clonedRepo.free();
}); });
test('successfully clones repository as bare', () { test('clones repository as bare', () {
final clonedRepo = Repository.clone( final clonedRepo = Repository.clone(
url: tmpDir.path, url: tmpDir.path,
localPath: cloneDir.path, localPath: cloneDir.path,
@ -54,8 +54,7 @@ void main() {
clonedRepo.free(); clonedRepo.free();
}); });
test('successfully clones repository with provided checkout branch name', test('clones repository with provided checkout branch name', () {
() {
final clonedRepo = Repository.clone( final clonedRepo = Repository.clone(
url: tmpDir.path, url: tmpDir.path,
localPath: cloneDir.path, localPath: cloneDir.path,
@ -70,7 +69,7 @@ void main() {
clonedRepo.free(); clonedRepo.free();
}); });
test('successfully clones repository with provided remote callback', () { test('clones repository with provided remote callback', () {
Remote remote(Repository repo, String name, String url) => Remote remote(Repository repo, String name, String url) =>
repo.createRemote(name: 'test', url: tmpDir.path); repo.createRemote(name: 'test', url: tmpDir.path);
@ -102,8 +101,7 @@ void main() {
); );
}); });
test('successfully clones repository with provided repository callback', test('clones repository with provided repository callback', () {
() {
final callbackPath = final callbackPath =
Directory('${Directory.systemTemp.path}/callbackRepo'); Directory('${Directory.systemTemp.path}/callbackRepo');
if (callbackPath.existsSync()) { if (callbackPath.existsSync()) {

View file

@ -84,12 +84,12 @@ void main() {
expect(repo.isBranchUnborn, true); expect(repo.isBranchUnborn, true);
}); });
test('successfully sets identity ', () { test('sets identity ', () {
repo.setIdentity(name: 'name', email: 'email@email.com'); repo.setIdentity(name: 'name', email: 'email@email.com');
expect(repo.identity, {'name': 'email@email.com'}); expect(repo.identity, {'name': 'email@email.com'});
}); });
test('successfully unsets identity', () { test('unsets identity', () {
repo.setIdentity(name: null, email: null); repo.setIdentity(name: null, email: null);
expect(repo.identity, isEmpty); expect(repo.identity, isEmpty);
}); });

View file

@ -20,14 +20,14 @@ void main() {
initDir.deleteSync(recursive: true); initDir.deleteSync(recursive: true);
}); });
group('Repository.init', () { group('Repository.init', () {
test('successfully creates new bare repo at provided path', () { test('creates new bare repo at provided path', () {
repo = Repository.init(path: initDir.path, bare: true); repo = Repository.init(path: initDir.path, bare: true);
expect(repo.path, contains('init_repo/')); expect(repo.path, contains('init_repo/'));
expect(repo.isBare, true); expect(repo.isBare, true);
}); });
test('successfully creates new standard repo at provided path', () { test('creates new standard repo at provided path', () {
repo = Repository.init(path: initDir.path); repo = Repository.init(path: initDir.path);
expect(repo.path, contains('init_repo/.git/')); expect(repo.path, contains('init_repo/.git/'));
@ -35,7 +35,7 @@ void main() {
expect(repo.isEmpty, true); expect(repo.isEmpty, true);
}); });
test('successfully creates new standard repo with provided options', () { test('creates new standard repo with provided options', () {
repo = Repository.init( repo = Repository.init(
path: initDir.path, path: initDir.path,
description: 'test repo', description: 'test repo',

View file

@ -78,7 +78,7 @@ void main() {
expect(repo.namespace, isEmpty); expect(repo.namespace, isEmpty);
}); });
test('successfully sets and unsets the namespace', () { test('sets and unsets the namespace', () {
expect(repo.namespace, ''); expect(repo.namespace, '');
repo.setNamespace('some'); repo.setNamespace('some');
expect(repo.namespace, 'some'); expect(repo.namespace, 'some');
@ -86,7 +86,7 @@ void main() {
expect(repo.namespace, ''); expect(repo.namespace, '');
}); });
test('successfully sets working directory', () { test('sets working directory', () {
final tmpWorkDir = Directory('${Directory.systemTemp.path}/tmp_work_dir'); final tmpWorkDir = Directory('${Directory.systemTemp.path}/tmp_work_dir');
tmpWorkDir.createSync(); tmpWorkDir.createSync();
@ -121,7 +121,7 @@ void main() {
setUp(() => head = repo.head); setUp(() => head = repo.head);
tearDown(() => head.free()); tearDown(() => head.free());
test('successfully sets head when target is reference', () { test('sets head when target is reference', () {
expect(repo.head.name, 'refs/heads/master'); expect(repo.head.name, 'refs/heads/master');
expect(repo.head.target.sha, lastCommit); expect(repo.head.target.sha, lastCommit);
repo.setHead('refs/heads/feature'); repo.setHead('refs/heads/feature');
@ -129,14 +129,14 @@ void main() {
expect(repo.head.target.sha, featureCommit); expect(repo.head.target.sha, featureCommit);
}); });
test('successfully sets head when target is sha hex', () { test('sets head when target is sha hex', () {
expect(repo.head.target.sha, lastCommit); expect(repo.head.target.sha, lastCommit);
repo.setHead(repo[featureCommit]); repo.setHead(repo[featureCommit]);
expect(repo.head.target.sha, featureCommit); expect(repo.head.target.sha, featureCommit);
expect(repo.isHeadDetached, true); expect(repo.isHeadDetached, true);
}); });
test('successfully attaches to an unborn branch', () { test('attaches to an unborn branch', () {
expect(repo.head.name, 'refs/heads/master'); expect(repo.head.name, 'refs/heads/master');
expect(repo.isBranchUnborn, false); expect(repo.isBranchUnborn, false);
repo.setHead('refs/heads/not.there'); repo.setHead('refs/heads/not.there');
@ -162,7 +162,7 @@ void main() {
group('createBlob', () { group('createBlob', () {
const newBlobContent = 'New blob\n'; const newBlobContent = 'New blob\n';
test('successfully creates new blob', () { test('creates new blob', () {
final oid = repo.createBlob(newBlobContent); final oid = repo.createBlob(newBlobContent);
final newBlob = repo.lookupBlob(oid); final newBlob = repo.lookupBlob(oid);
@ -171,8 +171,7 @@ void main() {
newBlob.free(); newBlob.free();
}); });
test('successfully creates new blob from file at provided relative path', test('creates new blob from file at provided relative path', () {
() {
final oid = repo.createBlobFromWorkdir('feature_file'); final oid = repo.createBlobFromWorkdir('feature_file');
final newBlob = repo.lookupBlob(oid); final newBlob = repo.lookupBlob(oid);
@ -181,7 +180,7 @@ void main() {
newBlob.free(); newBlob.free();
}); });
test('successfully creates new blob from file at provided path', () { test('creates new blob from file at provided path', () {
final outsideFile = final outsideFile =
File('${Directory.current.absolute.path}/test/blob_test.dart'); File('${Directory.current.absolute.path}/test/blob_test.dart');
final oid = repo.createBlobFromDisk(outsideFile.path); final oid = repo.createBlobFromDisk(outsideFile.path);
@ -193,7 +192,7 @@ void main() {
}); });
}); });
test('successfully creates tag with provided sha', () { test('creates tag with provided sha', () {
final signature = Signature.create( final signature = Signature.create(
name: 'Author', name: 'Author',
email: 'author@email.com', email: 'author@email.com',

View file

@ -23,7 +23,7 @@ void main() {
}); });
group('Reset', () { group('Reset', () {
test('successfully resets with hard', () { test('resets with hard', () {
var contents = file.readAsStringSync(); var contents = file.readAsStringSync();
expect(contents, 'Feature edit\n'); expect(contents, 'Feature edit\n');
@ -32,7 +32,7 @@ void main() {
expect(contents, isEmpty); expect(contents, isEmpty);
}); });
test('successfully resets with soft', () { test('resets with soft', () {
var contents = file.readAsStringSync(); var contents = file.readAsStringSync();
expect(contents, 'Feature edit\n'); expect(contents, 'Feature edit\n');
@ -47,7 +47,7 @@ void main() {
index.free(); index.free();
}); });
test('successfully resets with mixed', () { test('resets with mixed', () {
var contents = file.readAsStringSync(); var contents = file.readAsStringSync();
expect(contents, 'Feature edit\n'); expect(contents, 'Feature edit\n');
@ -63,7 +63,7 @@ void main() {
}); });
group('resetDefault', () { group('resetDefault', () {
test('successfully updates entry in the index', () { test('updates entry in the index', () {
file.writeAsStringSync('new edit'); file.writeAsStringSync('new edit');
final index = repo.index; final index = repo.index;

View file

@ -28,7 +28,7 @@ void main() {
}); });
group('RevWalk', () { group('RevWalk', () {
test('successfully initializes', () { test('initializes walker', () {
final walker = RevWalk(repo); final walker = RevWalk(repo);
expect(walker, isA<RevWalk>()); expect(walker, isA<RevWalk>());
walker.free(); walker.free();
@ -72,7 +72,7 @@ void main() {
walker.free(); walker.free();
}); });
test('successfully changes sorting', () { test('changes sorting', () {
final walker = RevWalk(repo); final walker = RevWalk(repo);
final start = Oid.fromSHA(repo: repo, sha: log.first); final start = Oid.fromSHA(repo: repo, sha: log.first);
@ -169,7 +169,7 @@ void main() {
walker.free(); walker.free();
}); });
test('successfully hides commit and its ancestors', () { test('hides commit and its ancestors', () {
final walker = RevWalk(repo); final walker = RevWalk(repo);
walker.push(repo[log.first]); walker.push(repo[log.first]);
@ -265,7 +265,7 @@ void main() {
walker.free(); walker.free();
}); });
test('successfully resets walker', () { test('resets walker', () {
final walker = RevWalk(repo); final walker = RevWalk(repo);
final start = Oid.fromSHA(repo: repo, sha: log.first); final start = Oid.fromSHA(repo: repo, sha: log.first);

View file

@ -20,7 +20,7 @@ void main() {
signature.free(); signature.free();
}); });
group('Signature', () { group('Signature', () {
test('successfully creates with provided time and offset', () { test('creates with provided time and offset', () {
expect(signature, isA<Signature>()); expect(signature, isA<Signature>());
}); });
@ -40,7 +40,7 @@ void main() {
); );
}); });
test('successfully creates without provided time and offset', () { test('creates without provided time and offset', () {
final sig = Signature.create(name: 'Name', email: 'email@example.com'); final sig = Signature.create(name: 'Name', email: 'email@example.com');
expect(sig, isA<Signature>()); expect(sig, isA<Signature>());
expect(sig.name, 'Name'); expect(sig.name, 'Name');

View file

@ -27,7 +27,7 @@ void main() {
}); });
group('Stash', () { group('Stash', () {
test('successfully saves changes to stash', () { test('saves changes to stash', () {
File('${tmpDir.path}/file').writeAsStringSync( File('${tmpDir.path}/file').writeAsStringSync(
'edit', 'edit',
mode: FileMode.append, mode: FileMode.append,
@ -44,7 +44,7 @@ void main() {
); );
}); });
test('successfully saves changes to stash including ignored', () { test('saves changes to stash including ignored', () {
final swpPath = File('${tmpDir.path}/some.swp'); final swpPath = File('${tmpDir.path}/some.swp');
swpPath.writeAsStringSync('ignored'); swpPath.writeAsStringSync('ignored');
@ -74,7 +74,7 @@ void main() {
index.free(); index.free();
}); });
test('successfully applies changes from stash', () { test('applies changes from stash', () {
File('${tmpDir.path}/file').writeAsStringSync( File('${tmpDir.path}/file').writeAsStringSync(
'edit', 'edit',
mode: FileMode.append, mode: FileMode.append,
@ -87,7 +87,7 @@ void main() {
expect(repo.status, contains('file')); expect(repo.status, contains('file'));
}); });
test('successfully applies changes from stash with paths provided', () { test('applies changes from stash with paths provided', () {
File('${tmpDir.path}/file').writeAsStringSync( File('${tmpDir.path}/file').writeAsStringSync(
'edit', 'edit',
mode: FileMode.append, mode: FileMode.append,
@ -100,7 +100,7 @@ void main() {
expect(repo.status, contains('file')); expect(repo.status, contains('file'));
}); });
test('successfully applies changes from stash including index changes', () { test('applies changes from stash including index changes', () {
File('${tmpDir.path}/stash.this').writeAsStringSync('stash'); File('${tmpDir.path}/stash.this').writeAsStringSync('stash');
final index = repo.index; final index = repo.index;
index.add('stash.this'); index.add('stash.this');
@ -128,7 +128,7 @@ void main() {
expect(() => repo.applyStash(index: 10), throwsA(isA<LibGit2Error>())); expect(() => repo.applyStash(index: 10), throwsA(isA<LibGit2Error>()));
}); });
test('successfully drops stash', () { test('drops stash', () {
File('${tmpDir.path}/file').writeAsStringSync( File('${tmpDir.path}/file').writeAsStringSync(
'edit', 'edit',
mode: FileMode.append, mode: FileMode.append,
@ -151,7 +151,7 @@ void main() {
expect(() => repo.dropStash(index: 10), throwsA(isA<LibGit2Error>())); expect(() => repo.dropStash(index: 10), throwsA(isA<LibGit2Error>()));
}); });
test('successfully pops from stash', () { test('pops from stash', () {
File('${tmpDir.path}/file').writeAsStringSync( File('${tmpDir.path}/file').writeAsStringSync(
'edit', 'edit',
mode: FileMode.append, mode: FileMode.append,
@ -163,7 +163,7 @@ void main() {
expect(() => repo.applyStash(), throwsA(isA<LibGit2Error>())); expect(() => repo.applyStash(), throwsA(isA<LibGit2Error>()));
}); });
test('successfully pops from stash with provided path', () { test('pops from stash with provided path', () {
File('${tmpDir.path}/file').writeAsStringSync( File('${tmpDir.path}/file').writeAsStringSync(
'edit', 'edit',
mode: FileMode.append, mode: FileMode.append,
@ -175,7 +175,7 @@ void main() {
expect(() => repo.applyStash(), throwsA(isA<LibGit2Error>())); expect(() => repo.applyStash(), throwsA(isA<LibGit2Error>()));
}); });
test('successfully pops from stash including index changes', () { test('pops from stash including index changes', () {
File('${tmpDir.path}/stash.this').writeAsStringSync('stash'); File('${tmpDir.path}/stash.this').writeAsStringSync('stash');
final index = repo.index; final index = repo.index;
index.add('stash.this'); index.add('stash.this');

View file

@ -33,7 +33,7 @@ void main() {
expect(repo.submodules.first, testSubmodule); expect(repo.submodules.first, testSubmodule);
}); });
test('successfully finds submodule with provided name/path', () { test('finds submodule with provided name/path', () {
final submodule = repo.lookupSubmodule(testSubmodule); final submodule = repo.lookupSubmodule(testSubmodule);
expect(submodule.name, testSubmodule); expect(submodule.name, testSubmodule);
@ -57,7 +57,7 @@ void main() {
); );
}); });
test('successfully inits and updates', () { test('inits and updates', () {
final submoduleFilePath = '${repo.workdir}$testSubmodule/master.txt'; final submoduleFilePath = '${repo.workdir}$testSubmodule/master.txt';
expect(File(submoduleFilePath).existsSync(), false); expect(File(submoduleFilePath).existsSync(), false);
@ -67,7 +67,7 @@ void main() {
expect(File(submoduleFilePath).existsSync(), true); expect(File(submoduleFilePath).existsSync(), true);
}); });
test('successfully updates with provided init flag', () { test('updates with provided init flag', () {
final submoduleFilePath = '${repo.workdir}$testSubmodule/master.txt'; final submoduleFilePath = '${repo.workdir}$testSubmodule/master.txt';
expect(File(submoduleFilePath).existsSync(), false); expect(File(submoduleFilePath).existsSync(), false);
@ -83,7 +83,7 @@ void main() {
); );
}); });
test('successfully opens repository for a submodule', () { test('opens repository for a submodule', () {
final submodule = repo.lookupSubmodule(testSubmodule); final submodule = repo.lookupSubmodule(testSubmodule);
repo.initSubmodule(submodule: testSubmodule); repo.initSubmodule(submodule: testSubmodule);
repo.updateSubmodule(submodule: testSubmodule); repo.updateSubmodule(submodule: testSubmodule);
@ -109,7 +109,7 @@ void main() {
submodule.free(); submodule.free();
}); });
test('successfully adds submodule', () { test('adds submodule', () {
final submodule = repo.addSubmodule( final submodule = repo.addSubmodule(
url: submoduleUrl, url: submoduleUrl,
path: 'test', path: 'test',
@ -144,7 +144,7 @@ void main() {
); );
}); });
test('successfully sets configuration values', () { test('sets configuration values', () {
final submodule = repo.lookupSubmodule(testSubmodule); final submodule = repo.lookupSubmodule(testSubmodule);
expect(submodule.url, submoduleUrl); expect(submodule.url, submoduleUrl);
expect(submodule.branch, ''); expect(submodule.branch, '');
@ -166,7 +166,7 @@ void main() {
submodule.free(); submodule.free();
}); });
test('successfully syncs', () { test('syncs', () {
repo.updateSubmodule(submodule: testSubmodule, init: true); repo.updateSubmodule(submodule: testSubmodule, init: true);
final submodule = repo.lookupSubmodule(testSubmodule); final submodule = repo.lookupSubmodule(testSubmodule);
final submRepo = submodule.open(); final submRepo = submodule.open();
@ -202,7 +202,7 @@ void main() {
submodule.free(); submodule.free();
}); });
test('successfully reloads info', () { test('reloads info', () {
final submodule = repo.lookupSubmodule(testSubmodule); final submodule = repo.lookupSubmodule(testSubmodule);
expect(submodule.url, submoduleUrl); expect(submodule.url, submoduleUrl);

View file

@ -26,7 +26,7 @@ void main() {
}); });
group('Tag', () { group('Tag', () {
test('successfully initializes tag from provided sha', () { test('initializes tag from provided sha', () {
expect(tag, isA<Tag>()); expect(tag, isA<Tag>());
}); });
@ -62,7 +62,7 @@ void main() {
target.free(); target.free();
}); });
test('successfully creates new tag with commit as target', () { test('creates new tag with commit as target', () {
final signature = Signature.create( final signature = Signature.create(
name: 'Author', name: 'Author',
email: 'author@email.com', email: 'author@email.com',
@ -95,7 +95,7 @@ void main() {
signature.free(); signature.free();
}); });
test('successfully creates new tag with tree as target', () { test('creates new tag with tree as target', () {
final signature = Signature.create( final signature = Signature.create(
name: 'Author', name: 'Author',
email: 'author@email.com', email: 'author@email.com',
@ -128,7 +128,7 @@ void main() {
signature.free(); signature.free();
}); });
test('successfully creates new tag with blob as target', () { test('creates new tag with blob as target', () {
final signature = Signature.create( final signature = Signature.create(
name: 'Author', name: 'Author',
email: 'author@email.com', email: 'author@email.com',
@ -161,7 +161,7 @@ void main() {
signature.free(); signature.free();
}); });
test('successfully creates new tag with tag as target', () { test('creates new tag with tag as target', () {
final signature = Signature.create( final signature = Signature.create(
name: 'Author', name: 'Author',
email: 'author@email.com', email: 'author@email.com',
@ -227,7 +227,7 @@ void main() {
expect(() => Repository(nullptr).tags, throwsA(isA<LibGit2Error>())); expect(() => Repository(nullptr).tags, throwsA(isA<LibGit2Error>()));
}); });
test('successfully deletes tag', () { test('deletes tag', () {
expect(repo.tags, ['v0.1', 'v0.2']); expect(repo.tags, ['v0.1', 'v0.2']);
repo.deleteTag('v0.2'); repo.deleteTag('v0.2');

View file

@ -26,7 +26,7 @@ void main() {
}); });
group('Tree', () { group('Tree', () {
test('successfully initializes tree from provided Oid', () { test('initializes tree from provided Oid', () {
expect(tree, isA<Tree>()); expect(tree, isA<Tree>());
expect(tree.toString(), contains('Tree{')); expect(tree.toString(), contains('Tree{'));
}); });
@ -77,7 +77,7 @@ void main() {
expect(() => tree[true], throwsA(isA<ArgumentError>())); expect(() => tree[true], throwsA(isA<ArgumentError>()));
}); });
test('successfully creates tree', () { test('creates tree', () {
final fileOid = repo.createBlob('blob content'); final fileOid = repo.createBlob('blob content');
final builder = TreeBuilder(repo: repo); final builder = TreeBuilder(repo: repo);

View file

@ -24,14 +24,14 @@ void main() {
}); });
group('TreeBuilder', () { group('TreeBuilder', () {
test('successfully initializes tree builder when no tree is provided', () { test('initializes tree builder when no tree is provided', () {
final builder = TreeBuilder(repo: repo); final builder = TreeBuilder(repo: repo);
expect(builder, isA<TreeBuilder>()); expect(builder, isA<TreeBuilder>());
expect(builder.toString(), contains('TreeBuilder{')); expect(builder.toString(), contains('TreeBuilder{'));
builder.free(); builder.free();
}); });
test('successfully initializes tree builder with provided tree', () { test('initializes tree builder with provided tree', () {
final builder = TreeBuilder(repo: repo, tree: tree); final builder = TreeBuilder(repo: repo, tree: tree);
final oid = builder.write(); final oid = builder.write();
@ -59,7 +59,7 @@ void main() {
builder.free(); builder.free();
}); });
test('successfully builds the tree builder from entry of tree', () { test('builds the tree builder from entry of tree', () {
final builder = TreeBuilder(repo: repo); final builder = TreeBuilder(repo: repo);
final entry = tree.entries[0]; final entry = tree.entries[0];
@ -99,7 +99,7 @@ void main() {
builder.free(); builder.free();
}); });
test('successfully removes an entry', () { test('removes an entry', () {
final builder = TreeBuilder(repo: repo, tree: tree); final builder = TreeBuilder(repo: repo, tree: tree);
expect(builder.length, tree.length); expect(builder.length, tree.length);

View file

@ -29,7 +29,7 @@ void main() {
}); });
group('Worktree', () { group('Worktree', () {
test('successfully creates worktree at provided path', () { test('creates worktree at provided path', () {
expect(repo.worktrees, <String>[]); expect(repo.worktrees, <String>[]);
final worktree = repo.createWorktree( final worktree = repo.createWorktree(
@ -52,9 +52,7 @@ void main() {
worktree.free(); worktree.free();
}); });
test( test('creates worktree at provided path from provided reference', () {
'successfully creates worktree at provided path from '
'provided reference', () {
final head = repo.revParseSingle('HEAD'); final head = repo.revParseSingle('HEAD');
final worktreeBranch = repo.createBranch(name: 'v1', target: head); final worktreeBranch = repo.createBranch(name: 'v1', target: head);
final ref = repo.lookupReference('refs/heads/v1'); final ref = repo.lookupReference('refs/heads/v1');
@ -105,7 +103,7 @@ void main() {
); );
}); });
test('successfully lookups worktree', () { test('lookups worktree', () {
final worktree = repo.createWorktree( final worktree = repo.createWorktree(
name: worktreeName, name: worktreeName,
path: worktreeDir.path, path: worktreeDir.path,
@ -127,7 +125,7 @@ void main() {
); );
}); });
test('successfully locks and unlocks worktree', () { test('locks and unlocks worktree', () {
final worktree = repo.createWorktree( final worktree = repo.createWorktree(
name: worktreeName, name: worktreeName,
path: worktreeDir.path, path: worktreeDir.path,
@ -143,7 +141,7 @@ void main() {
worktree.free(); worktree.free();
}); });
test('successfully prunes worktree', () { test('prunes worktree', () {
expect(repo.worktrees, <String>[]); expect(repo.worktrees, <String>[]);
final worktree = repo.createWorktree( final worktree = repo.createWorktree(