test: fix tests failing on windows

This commit is contained in:
Aleksey Kulikov 2021-12-31 12:24:18 +03:00
parent 59cf7174f6
commit d86617d58b
3 changed files with 15 additions and 12 deletions

View file

@ -122,7 +122,7 @@ void main() {
expect(clonedRepo.isEmpty, false); expect(clonedRepo.isEmpty, false);
expect(clonedRepo.isBare, false); expect(clonedRepo.isBare, false);
expect(clonedRepo.path, contains(p.join('callbackRepo', '.git'))); expect(clonedRepo.path, contains('/callbackRepo/.git/'));
clonedRepo.free(); clonedRepo.free();
callbackPath.deleteSync(recursive: true); callbackPath.deleteSync(recursive: true);

View file

@ -6,8 +6,6 @@ import 'package:test/test.dart';
void main() { void main() {
late Repository repo; late Repository repo;
final barePath = p.join('test', 'assets', 'empty_bare.git');
final standardPath = p.join('test', 'assets', 'empty_standard', '.gitdir');
group('Repository.open', () { group('Repository.open', () {
test("throws when repository isn't found at provided path", () { test("throws when repository isn't found at provided path", () {
@ -19,7 +17,7 @@ void main() {
group('empty bare', () { group('empty bare', () {
setUp(() { setUp(() {
repo = Repository.open(barePath); repo = Repository.open(p.join('test', 'assets', 'empty_bare.git'));
}); });
tearDown(() { tearDown(() {
@ -35,11 +33,11 @@ void main() {
}); });
test('returns path to the repository', () { test('returns path to the repository', () {
expect(repo.path, contains(barePath)); expect(repo.path, contains('/test/assets/empty_bare.git/'));
}); });
test('returns path to root directory for the repository', () { test('returns path to root directory for the repository', () {
expect(repo.commonDir, contains(barePath)); expect(repo.commonDir, contains('/test/assets/empty_bare.git/'));
}); });
test('returns empty string as path of the working directory', () { test('returns empty string as path of the working directory', () {
@ -49,7 +47,9 @@ void main() {
group('empty standard', () { group('empty standard', () {
setUp(() { setUp(() {
repo = Repository.open(standardPath); repo = Repository.open(
p.join('test', 'assets', 'empty_standard', '.gitdir'),
);
}); });
tearDown(() { tearDown(() {
@ -61,11 +61,14 @@ void main() {
}); });
test('returns path to the repository', () { test('returns path to the repository', () {
expect(repo.path, contains(standardPath)); expect(repo.path, contains('/test/assets/empty_standard/.gitdir/'));
}); });
test("returns path to parent repo's .git folder for the repository", () { test("returns path to parent repo's .git folder for the repository", () {
expect(repo.commonDir, contains(standardPath)); expect(
repo.commonDir,
contains('/test/assets/empty_standard/.gitdir/'),
);
}); });
test('checks if it is empty', () { test('checks if it is empty', () {
@ -105,7 +108,7 @@ void main() {
test('returns path to working directory', () { test('returns path to working directory', () {
expect( expect(
repo.workdir, repo.workdir,
contains(p.join('test', 'assets', 'empty_standard')), contains('/test/assets/empty_standard/'),
); );
}); });
}); });

View file

@ -31,7 +31,7 @@ void main() {
test('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(p.join('init_repo', '.git'))); expect(repo.path, contains('init_repo/.git/'));
expect(repo.isBare, false); expect(repo.isBare, false);
expect(repo.isEmpty, true); expect(repo.isEmpty, true);
}); });
@ -44,7 +44,7 @@ void main() {
flags: {GitRepositoryInit.mkdir, GitRepositoryInit.mkpath}, flags: {GitRepositoryInit.mkdir, GitRepositoryInit.mkpath},
); );
expect(repo.path, contains(p.join('init_repo', '.git'))); expect(repo.path, contains('init_repo/.git/'));
expect(repo.isBare, false); expect(repo.isBare, false);
expect(repo.isEmpty, true); expect(repo.isEmpty, true);
expect( expect(