mirror of
https://github.com/SkinnyMind/libgit2dart.git
synced 2025-05-04 20:29:08 -04:00
feat(config): add ability to set value of multivar variable
This commit is contained in:
parent
6a08a7b803
commit
7bea406ab9
3 changed files with 51 additions and 6 deletions
|
@ -10,12 +10,12 @@ void main() {
|
|||
const configFileName = 'test_config';
|
||||
const contents = '''
|
||||
[core]
|
||||
repositoryformatversion = 0
|
||||
bare = false
|
||||
gitproxy = proxy-command for kernel.org
|
||||
gitproxy = default-proxy
|
||||
\trepositoryformatversion = 0
|
||||
\tbare = false
|
||||
\tgitproxy = proxy-command for kernel.org
|
||||
\tgitproxy = default-proxy
|
||||
[remote "origin"]
|
||||
url = someurl
|
||||
\turl = someurl
|
||||
''';
|
||||
|
||||
late Config config;
|
||||
|
@ -90,6 +90,22 @@ void main() {
|
|||
['proxy-command for kernel.org'],
|
||||
);
|
||||
});
|
||||
|
||||
test('sets value of multivar', () {
|
||||
config.setMultivar('core.gitproxy', 'default', 'updated');
|
||||
final multivarValues = config.getMultivar('core.gitproxy');
|
||||
expect(multivarValues, isNot(contains('default-proxy')));
|
||||
expect(multivarValues, contains('updated'));
|
||||
});
|
||||
|
||||
test('sets value for all multivar values when regexp is empty', () {
|
||||
config.setMultivar('core.gitproxy', '', 'updated');
|
||||
final multivarValues = config.getMultivar('core.gitproxy');
|
||||
expect(multivarValues, isNot(contains('default-proxy')));
|
||||
expect(multivarValues, isNot(contains('proxy-command for kernel.org')));
|
||||
expect(multivarValues, contains('updated'));
|
||||
expect(multivarValues.length, equals(2));
|
||||
});
|
||||
});
|
||||
;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue