feat: add ability to compare objects (#54)

This commit is contained in:
Aleksey Kulikov 2022-05-10 16:18:55 +03:00 committed by GitHub
parent 5dfedadfe6
commit bad40bdb61
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
45 changed files with 466 additions and 137 deletions

View file

@ -33,6 +33,7 @@ void main() {
expect(remote.url, remoteUrl);
expect(remote.pushUrl, '');
expect(remote.toString(), contains('Remote{'));
expect(remote, equals(Remote.lookup(repo: repo, name: 'origin')));
});
test('throws when provided name for lookup is not found', () {
@ -42,6 +43,13 @@ void main() {
);
});
test('throws when trying to create remote and name already exists', () {
expect(
() => Remote.create(repo: repo, name: 'origin', url: remoteUrl),
throwsA(isA<LibGit2Error>()),
);
});
test('creates without fetchspec', () {
final remote = Remote.create(
repo: repo,
@ -188,6 +196,8 @@ void main() {
refspec.rTransform('refs/remotes/origin/master'),
'refs/heads/master',
);
expect(refspec, equals(remote.getRefspec(0)));
});
test('throws when trying to transform refspec with invalid reference name',
@ -270,6 +280,7 @@ void main() {
expect(refs.first.symRef, 'refs/heads/master');
expect((refs.first.oid).sha, '49322bb17d3acc9146f98c97d078513228bbf3c0');
expect(refs.first.toString(), contains('RemoteReference{'));
expect(refs.first, remote.ls().first);
});
test(