mirror of
https://github.com/SkinnyMind/libgit2dart.git
synced 2025-05-04 20:29:08 -04:00
feat(config): add ability to get value(s) of multivar variable
This commit is contained in:
parent
4988b295a5
commit
6a08a7b803
3 changed files with 68 additions and 6 deletions
|
@ -8,6 +8,16 @@ import 'package:libgit2dart/src/error.dart';
|
|||
void main() {
|
||||
final tmpDir = Directory.systemTemp.path;
|
||||
const configFileName = 'test_config';
|
||||
const contents = '''
|
||||
[core]
|
||||
repositoryformatversion = 0
|
||||
bare = false
|
||||
gitproxy = proxy-command for kernel.org
|
||||
gitproxy = default-proxy
|
||||
[remote "origin"]
|
||||
url = someurl
|
||||
''';
|
||||
|
||||
late Config config;
|
||||
|
||||
group('Config', () {
|
||||
|
@ -16,8 +26,7 @@ void main() {
|
|||
});
|
||||
|
||||
setUp(() {
|
||||
File('$tmpDir/$configFileName').writeAsStringSync(
|
||||
'[core]\n\trepositoryformatversion = 0\n\tbare = false\n[remote "origin"]\n\turl = someurl');
|
||||
File('$tmpDir/$configFileName').writeAsStringSync(contents);
|
||||
config = Config.open(path: '$tmpDir/$configFileName');
|
||||
});
|
||||
|
||||
|
@ -64,6 +73,23 @@ void main() {
|
|||
throwsA(isA<LibGit2Error>()),
|
||||
);
|
||||
});
|
||||
|
||||
test('returns values of multivar', () {
|
||||
expect(
|
||||
config.getMultivar('core.gitproxy'),
|
||||
[
|
||||
'proxy-command for kernel.org',
|
||||
'default-proxy',
|
||||
],
|
||||
);
|
||||
});
|
||||
|
||||
test('returns values of multivar with regexp', () {
|
||||
expect(
|
||||
config.getMultivar('core.gitproxy', regexp: 'for kernel.org\$'),
|
||||
['proxy-command for kernel.org'],
|
||||
);
|
||||
});
|
||||
});
|
||||
;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue