-
-
Notifications
You must be signed in to change notification settings - Fork 14
/
Copy pathconfig_test.dart
65 lines (51 loc) · 1.54 KB
/
config_test.dart
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
import 'package:test/test.dart';
import 'package:dart_git/config.dart';
void main() {
var contents = '''[core]
repositoryformatversion = 0
filemode = true
bare = false
logallrefupdates = true
ignorecase = true
precomposeunicode = true
[remote "origin"]
url = https://github.com/src-d/go-git.git
fetch = +refs/heads/*:refs/remotes/origin/*
[branch "master"]
remote = origin
merge = refs/heads/master
[branch "foo"]
remote = origin
merge = refs/heads/master
[user]
name = Mona Lisa
email = mona@lisa.com
''';
test('Config Branches Test', () async {
var config = Config(contents);
expect(config.branches.length, 2);
var branch = config.branch('master')!;
expect(branch.name, 'master');
expect(branch.remote, 'origin');
expect(branch.merge!.value, 'refs/heads/master');
branch = config.branch('foo')!;
expect(branch.name, 'foo');
expect(branch.remote, 'origin');
expect(branch.merge!.value, 'refs/heads/master');
expect(config.remotes.length, 1);
var remote = config.remotes[0];
expect(remote.name, 'origin');
expect(remote.url, 'https://github.com/src-d/go-git.git');
expect(remote.fetch, '+refs/heads/*:refs/remotes/origin/*');
expect(config.user!.name, 'Mona Lisa');
expect(config.user!.email, 'mona@lisa.com');
});
test('Config Serialization', () async {
var config = Config(contents);
expect(config.serialize(), contents);
});
test('ConfigFile Serialization', () async {
var cf = ConfigFile.parse(contents);
expect(cf.serialize(), contents);
});
}