mirror of
https://github.com/SkinnyMind/libgit2dart.git
synced 2025-05-04 20:29:08 -04:00
style: use "map/where" instead of "for" loop
This commit is contained in:
parent
3a0fa75929
commit
cfa5268af2
28 changed files with 193 additions and 323 deletions
|
@ -313,7 +313,7 @@ index e69de29..c217c63 100644
|
|||
expect(patches.length, 8);
|
||||
expect(patches.first.delta.status, GitDelta.deleted);
|
||||
|
||||
for (var p in patches) {
|
||||
for (final p in patches) {
|
||||
p.free();
|
||||
}
|
||||
diff.free();
|
||||
|
|
|
@ -6,7 +6,7 @@ void main() {
|
|||
test('returns list of compile time options for libgit2', () {
|
||||
expect(
|
||||
Features.list,
|
||||
[GitFeature.threads, GitFeature.https, GitFeature.ssh, GitFeature.nsec],
|
||||
{GitFeature.threads, GitFeature.https, GitFeature.ssh, GitFeature.nsec},
|
||||
);
|
||||
});
|
||||
});
|
||||
|
|
|
@ -148,7 +148,7 @@ Santa Claus <santa.claus@northpole.xx> <me@company.xx>
|
|||
final mailmap = Mailmap.fromBuffer(testMailmap);
|
||||
expect(mailmap, isA<Mailmap>());
|
||||
|
||||
for (var entry in testResolve) {
|
||||
for (final entry in testResolve) {
|
||||
expect(
|
||||
mailmap.resolve(name: entry['name']!, email: entry['email']!),
|
||||
[entry['realName'], entry['realEmail']],
|
||||
|
@ -162,7 +162,7 @@ Santa Claus <santa.claus@northpole.xx> <me@company.xx>
|
|||
final mailmap = Mailmap.fromRepository(repo);
|
||||
expect(mailmap, isA<Mailmap>());
|
||||
|
||||
for (var entry in testResolve) {
|
||||
for (final entry in testResolve) {
|
||||
expect(
|
||||
mailmap.resolve(name: entry['name']!, email: entry['email']!),
|
||||
[entry['realName'], entry['realEmail']],
|
||||
|
@ -175,7 +175,7 @@ Santa Claus <santa.claus@northpole.xx> <me@company.xx>
|
|||
test('successfully resolves names and emails when mailmap is empty', () {
|
||||
final mailmap = Mailmap.empty();
|
||||
|
||||
for (var entry in testResolve) {
|
||||
for (final entry in testResolve) {
|
||||
expect(
|
||||
mailmap.resolve(name: entry['name']!, email: entry['email']!),
|
||||
[entry['name'], entry['email']],
|
||||
|
@ -188,7 +188,7 @@ Santa Claus <santa.claus@northpole.xx> <me@company.xx>
|
|||
test('successfully adds entries and resolves them', () {
|
||||
final mailmap = Mailmap.empty();
|
||||
|
||||
for (var entry in testEntries) {
|
||||
for (final entry in testEntries) {
|
||||
mailmap.addEntry(
|
||||
realName: entry['realName'],
|
||||
realEmail: entry['realEmail'],
|
||||
|
@ -197,7 +197,7 @@ Santa Claus <santa.claus@northpole.xx> <me@company.xx>
|
|||
);
|
||||
}
|
||||
|
||||
for (var entry in testResolve) {
|
||||
for (final entry in testResolve) {
|
||||
expect(
|
||||
mailmap.resolve(name: entry['name']!, email: entry['email']!),
|
||||
[entry['realName'], entry['realEmail']],
|
||||
|
|
|
@ -27,8 +27,10 @@ void main() {
|
|||
);
|
||||
|
||||
final result = repo.mergeAnalysis(theirHead: commit.id);
|
||||
expect(result[0], {GitMergeAnalysis.upToDate});
|
||||
expect(result[1], {GitMergePreference.none});
|
||||
expect(result, [
|
||||
{GitMergeAnalysis.upToDate},
|
||||
GitMergePreference.none,
|
||||
]);
|
||||
expect(repo.status, isEmpty);
|
||||
|
||||
commit.free();
|
||||
|
|
|
@ -87,9 +87,9 @@ void main() {
|
|||
test('successfully packs with provided packDelegate', () {
|
||||
void packDelegate(PackBuilder packBuilder) {
|
||||
final branches = repo.branches;
|
||||
for (var branch in branches) {
|
||||
for (final branch in branches) {
|
||||
final ref = repo.lookupReference('refs/heads/${branch.name}');
|
||||
for (var commit in repo.log(sha: ref.target.sha)) {
|
||||
for (final commit in repo.log(sha: ref.target.sha)) {
|
||||
packBuilder.addRecursively(commit.id);
|
||||
commit.free();
|
||||
}
|
||||
|
|
|
@ -45,7 +45,7 @@ void main() {
|
|||
expect(commits[i].id.sha, log[i]);
|
||||
}
|
||||
|
||||
for (var c in commits) {
|
||||
for (final c in commits) {
|
||||
c.free();
|
||||
}
|
||||
});
|
||||
|
|
|
@ -36,7 +36,7 @@ void main() {
|
|||
expect(commits[i].id.sha, log[i]);
|
||||
}
|
||||
|
||||
for (var c in commits) {
|
||||
for (final c in commits) {
|
||||
c.free();
|
||||
}
|
||||
walker.free();
|
||||
|
@ -54,7 +54,7 @@ void main() {
|
|||
expect(commits[i].id.sha, log.reversed.toList()[i]);
|
||||
}
|
||||
|
||||
for (var c in commits) {
|
||||
for (final c in commits) {
|
||||
c.free();
|
||||
}
|
||||
walker.free();
|
||||
|
@ -77,10 +77,10 @@ void main() {
|
|||
expect(reverseSortedCommits[i].id.sha, log.reversed.toList()[i]);
|
||||
}
|
||||
|
||||
for (var c in timeSortedCommits) {
|
||||
for (final c in timeSortedCommits) {
|
||||
c.free();
|
||||
}
|
||||
for (var c in reverseSortedCommits) {
|
||||
for (final c in reverseSortedCommits) {
|
||||
c.free();
|
||||
}
|
||||
walker.free();
|
||||
|
@ -97,7 +97,7 @@ void main() {
|
|||
|
||||
expect(commits.length, 2);
|
||||
|
||||
for (var c in commits) {
|
||||
for (final c in commits) {
|
||||
c.free();
|
||||
}
|
||||
walker.free();
|
||||
|
@ -129,7 +129,7 @@ void main() {
|
|||
expect(commits.length, 3);
|
||||
}
|
||||
|
||||
for (var c in commits) {
|
||||
for (final c in commits) {
|
||||
c.free();
|
||||
}
|
||||
walker.free();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue