mirror of
https://github.com/SkinnyMind/libgit2dart.git
synced 2025-05-04 20:29:08 -04:00
feat(config): add ability to delete multivar
This commit is contained in:
parent
dadd235b66
commit
36f874c4a6
3 changed files with 63 additions and 5 deletions
|
@ -80,6 +80,7 @@ void main() {
|
|||
|
||||
group('deleteEntry()', () {
|
||||
test('successfully deletes entry', () {
|
||||
expect(config.getValue('core.bare'), equals('false'));
|
||||
config.deleteEntry('core.bare');
|
||||
final entries = config.getEntries();
|
||||
expect(entries['core.bare'], isNull);
|
||||
|
@ -133,6 +134,37 @@ void main() {
|
|||
expect(multivarValues.length, equals(2));
|
||||
});
|
||||
});
|
||||
|
||||
group('deleteMultivar()', () {
|
||||
test('successfully deletes value of a multivar', () {
|
||||
expect(
|
||||
config.getMultivarValue('core.gitproxy', regexp: 'for kernel.org\$'),
|
||||
['proxy-command for kernel.org'],
|
||||
);
|
||||
|
||||
config.deleteMultivar('core.gitproxy', 'for kernel.org\$');
|
||||
|
||||
expect(
|
||||
config.getMultivarValue('core.gitproxy', regexp: 'for kernel.org\$'),
|
||||
[],
|
||||
);
|
||||
});
|
||||
|
||||
test('successfully deletes all values of a multivar when regexp is empty',
|
||||
() {
|
||||
expect(
|
||||
config.getMultivarValue('core.gitproxy'),
|
||||
[
|
||||
'proxy-command for kernel.org',
|
||||
'default-proxy',
|
||||
],
|
||||
);
|
||||
|
||||
config.deleteMultivar('core.gitproxy', '');
|
||||
|
||||
expect(config.getMultivarValue('core.gitproxy'), []);
|
||||
});
|
||||
});
|
||||
});
|
||||
;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue