mirror of
https://github.com/SkinnyMind/libgit2dart.git
synced 2025-05-05 04:39:07 -04:00
test: remove unnecessary variables declarations
This commit is contained in:
parent
76b8de1f80
commit
28f08e308a
23 changed files with 416 additions and 492 deletions
|
@ -33,15 +33,7 @@ void main() {
|
|||
time: 1234,
|
||||
);
|
||||
final master = Reference.lookup(repo: repo, name: 'refs/heads/master');
|
||||
final branchHead = AnnotatedCommit.fromReference(
|
||||
repo: repo,
|
||||
reference: master,
|
||||
);
|
||||
final feature = Reference.lookup(repo: repo, name: 'refs/heads/feature');
|
||||
final ontoHead = AnnotatedCommit.fromReference(
|
||||
repo: repo,
|
||||
reference: feature,
|
||||
);
|
||||
|
||||
Checkout.reference(repo: repo, name: feature.name);
|
||||
repo.setHead(feature.name);
|
||||
|
@ -49,8 +41,8 @@ void main() {
|
|||
|
||||
final rebase = Rebase.init(
|
||||
repo: repo,
|
||||
branch: branchHead,
|
||||
onto: ontoHead,
|
||||
branch: AnnotatedCommit.fromReference(repo: repo, reference: master),
|
||||
onto: AnnotatedCommit.fromReference(repo: repo, reference: feature),
|
||||
);
|
||||
|
||||
expect(rebase.origHeadOid, master.target);
|
||||
|
@ -85,11 +77,10 @@ void main() {
|
|||
time: 1234,
|
||||
);
|
||||
final feature = Reference.lookup(repo: repo, name: 'refs/heads/feature');
|
||||
final ontoHead = AnnotatedCommit.lookup(repo: repo, oid: feature.target);
|
||||
|
||||
final rebase = Rebase.init(
|
||||
repo: repo,
|
||||
onto: ontoHead,
|
||||
onto: AnnotatedCommit.lookup(repo: repo, oid: feature.target),
|
||||
);
|
||||
|
||||
expect(
|
||||
|
@ -126,9 +117,7 @@ void main() {
|
|||
time: 1234,
|
||||
);
|
||||
final master = Reference.lookup(repo: repo, name: 'refs/heads/master');
|
||||
final branchHead = AnnotatedCommit.lookup(repo: repo, oid: master.target);
|
||||
final feature = Reference.lookup(repo: repo, name: 'refs/heads/feature');
|
||||
final upstream = AnnotatedCommit.lookup(repo: repo, oid: repo[shas[1]]);
|
||||
|
||||
Checkout.reference(repo: repo, name: feature.name);
|
||||
repo.setHead(feature.name);
|
||||
|
@ -136,8 +125,8 @@ void main() {
|
|||
|
||||
final rebase = Rebase.init(
|
||||
repo: repo,
|
||||
branch: branchHead,
|
||||
upstream: upstream,
|
||||
branch: AnnotatedCommit.lookup(repo: repo, oid: master.target),
|
||||
upstream: AnnotatedCommit.lookup(repo: repo, oid: repo[shas[1]]),
|
||||
);
|
||||
|
||||
expect(rebase.origHeadOid, master.target);
|
||||
|
@ -172,21 +161,21 @@ void main() {
|
|||
email: 'author@email.com',
|
||||
time: 1234,
|
||||
);
|
||||
final master = Reference.lookup(repo: repo, name: 'refs/heads/master');
|
||||
final branchHead = AnnotatedCommit.lookup(repo: repo, oid: master.target);
|
||||
final conflict = Reference.lookup(
|
||||
repo: repo,
|
||||
name: 'refs/heads/conflict-branch',
|
||||
);
|
||||
final ontoHead = AnnotatedCommit.lookup(repo: repo, oid: conflict.target);
|
||||
|
||||
Checkout.reference(repo: repo, name: conflict.name);
|
||||
repo.setHead(conflict.name);
|
||||
|
||||
final rebase = Rebase.init(
|
||||
repo: repo,
|
||||
branch: branchHead,
|
||||
onto: ontoHead,
|
||||
branch: AnnotatedCommit.lookup(
|
||||
repo: repo,
|
||||
oid: Reference.lookup(repo: repo, name: 'refs/heads/master').target,
|
||||
),
|
||||
onto: AnnotatedCommit.lookup(repo: repo, oid: conflict.target),
|
||||
);
|
||||
expect(rebase.operations.length, 1);
|
||||
|
||||
|
@ -201,21 +190,21 @@ void main() {
|
|||
|
||||
test('throws when trying to perfrom next rebase operation and error occurs',
|
||||
() {
|
||||
final master = Reference.lookup(repo: repo, name: 'refs/heads/master');
|
||||
final branchHead = AnnotatedCommit.lookup(repo: repo, oid: master.target);
|
||||
final conflict = Reference.lookup(
|
||||
repo: repo,
|
||||
name: 'refs/heads/conflict-branch',
|
||||
);
|
||||
final ontoHead = AnnotatedCommit.lookup(repo: repo, oid: conflict.target);
|
||||
|
||||
Checkout.reference(repo: repo, name: conflict.name);
|
||||
repo.setHead(conflict.name);
|
||||
|
||||
final rebase = Rebase.init(
|
||||
repo: repo,
|
||||
branch: branchHead,
|
||||
onto: ontoHead,
|
||||
branch: AnnotatedCommit.lookup(
|
||||
repo: repo,
|
||||
oid: Reference.lookup(repo: repo, name: 'refs/heads/master').target,
|
||||
),
|
||||
onto: AnnotatedCommit.lookup(repo: repo, oid: conflict.target),
|
||||
);
|
||||
expect(rebase.operations.length, 1);
|
||||
|
||||
|
@ -224,21 +213,21 @@ void main() {
|
|||
});
|
||||
|
||||
test('aborts rebase in progress', () {
|
||||
final master = Reference.lookup(repo: repo, name: 'refs/heads/master');
|
||||
final branchHead = AnnotatedCommit.lookup(repo: repo, oid: master.target);
|
||||
final conflict = Reference.lookup(
|
||||
repo: repo,
|
||||
name: 'refs/heads/conflict-branch',
|
||||
);
|
||||
final ontoHead = AnnotatedCommit.lookup(repo: repo, oid: conflict.target);
|
||||
|
||||
Checkout.reference(repo: repo, name: conflict.name);
|
||||
repo.setHead(conflict.name);
|
||||
|
||||
final rebase = Rebase.init(
|
||||
repo: repo,
|
||||
branch: branchHead,
|
||||
onto: ontoHead,
|
||||
branch: AnnotatedCommit.lookup(
|
||||
repo: repo,
|
||||
oid: Reference.lookup(repo: repo, name: 'refs/heads/master').target,
|
||||
),
|
||||
onto: AnnotatedCommit.lookup(repo: repo, oid: conflict.target),
|
||||
);
|
||||
expect(rebase.operations.length, 1);
|
||||
|
||||
|
@ -252,12 +241,12 @@ void main() {
|
|||
});
|
||||
|
||||
test('opens an existing rebase', () {
|
||||
final feature = Reference.lookup(repo: repo, name: 'refs/heads/feature');
|
||||
final ontoHead = AnnotatedCommit.lookup(repo: repo, oid: feature.target);
|
||||
|
||||
final rebase = Rebase.init(
|
||||
repo: repo,
|
||||
onto: ontoHead,
|
||||
onto: AnnotatedCommit.lookup(
|
||||
repo: repo,
|
||||
oid: Reference.lookup(repo: repo, name: 'refs/heads/feature').target,
|
||||
),
|
||||
);
|
||||
expect(rebase.operations.length, 3);
|
||||
|
||||
|
@ -270,11 +259,12 @@ void main() {
|
|||
});
|
||||
|
||||
test('manually releases allocated memory', () {
|
||||
final feature = Reference.lookup(repo: repo, name: 'refs/heads/feature');
|
||||
final ontoHead = AnnotatedCommit.lookup(repo: repo, oid: feature.target);
|
||||
final rebase = Rebase.init(
|
||||
repo: repo,
|
||||
onto: ontoHead,
|
||||
onto: AnnotatedCommit.lookup(
|
||||
repo: repo,
|
||||
oid: Reference.lookup(repo: repo, name: 'refs/heads/feature').target,
|
||||
),
|
||||
);
|
||||
|
||||
expect(() => rebase.free(), returnsNormally);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue