mirror of
https://github.com/SkinnyMind/libgit2dart.git
synced 2025-05-04 20:29:08 -04:00
refactor: compose paths using path package
This commit is contained in:
parent
f2e78daa42
commit
59cf7174f6
36 changed files with 225 additions and 201 deletions
|
@ -1,11 +1,12 @@
|
|||
import 'dart:io';
|
||||
|
||||
import 'package:libgit2dart/libgit2dart.dart';
|
||||
import 'package:path/path.dart' as p;
|
||||
import 'package:test/test.dart';
|
||||
|
||||
void main() {
|
||||
late Repository repo;
|
||||
final initDir = Directory('${Directory.systemTemp.path}/init_repo');
|
||||
final initDir = Directory(p.join(Directory.systemTemp.path, 'init_repo'));
|
||||
|
||||
setUp(() {
|
||||
if (initDir.existsSync()) {
|
||||
|
@ -23,14 +24,14 @@ void main() {
|
|||
test('creates new bare repo at provided path', () {
|
||||
repo = Repository.init(path: initDir.path, bare: true);
|
||||
|
||||
expect(repo.path, contains('init_repo/'));
|
||||
expect(repo.path, contains('init_repo'));
|
||||
expect(repo.isBare, true);
|
||||
});
|
||||
|
||||
test('creates new standard repo at provided path', () {
|
||||
repo = Repository.init(path: initDir.path);
|
||||
|
||||
expect(repo.path, contains('init_repo/.git/'));
|
||||
expect(repo.path, contains(p.join('init_repo', '.git')));
|
||||
expect(repo.isBare, false);
|
||||
expect(repo.isEmpty, true);
|
||||
});
|
||||
|
@ -43,11 +44,11 @@ void main() {
|
|||
flags: {GitRepositoryInit.mkdir, GitRepositoryInit.mkpath},
|
||||
);
|
||||
|
||||
expect(repo.path, contains('init_repo/.git/'));
|
||||
expect(repo.path, contains(p.join('init_repo', '.git')));
|
||||
expect(repo.isBare, false);
|
||||
expect(repo.isEmpty, true);
|
||||
expect(
|
||||
File('${repo.workdir}.git/description').readAsStringSync(),
|
||||
File(p.join(repo.path, 'description')).readAsStringSync(),
|
||||
'test repo',
|
||||
);
|
||||
expect(repo.lookupRemote('origin').url, 'test.url');
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue