mirror of
https://github.com/SkinnyMind/libgit2dart.git
synced 2025-05-04 20:29:08 -04:00
feat(index): add ability to change attributes of index entry
This commit is contained in:
parent
5b8f089723
commit
06b44597d5
4 changed files with 48 additions and 7 deletions
|
@ -1,8 +1,10 @@
|
|||
import 'dart:io';
|
||||
|
||||
import 'package:libgit2dart/libgit2dart.dart';
|
||||
import 'package:test/test.dart';
|
||||
import 'package:libgit2dart/src/index.dart';
|
||||
import 'package:libgit2dart/src/repository.dart';
|
||||
import 'package:libgit2dart/src/types.dart';
|
||||
import 'package:libgit2dart/src/error.dart';
|
||||
|
||||
import 'helpers/util.dart';
|
||||
|
@ -60,6 +62,22 @@ void main() {
|
|||
expect(() => index[10], throwsA(isA<ArgumentError>()));
|
||||
});
|
||||
|
||||
test('successfully changes attributes', () {
|
||||
final entry = index['file'];
|
||||
final otherEntry = index['feature_file'];
|
||||
|
||||
expect(entry.id == otherEntry.id, false);
|
||||
expect(entry.mode, isNot(GitFilemode.blobExecutable));
|
||||
|
||||
entry.path = 'some.txt';
|
||||
entry.id = otherEntry.id;
|
||||
entry.mode = GitFilemode.blobExecutable;
|
||||
|
||||
expect(entry.path, 'some.txt');
|
||||
expect(entry.id == otherEntry.id, true);
|
||||
expect(entry.mode, GitFilemode.blobExecutable);
|
||||
});
|
||||
|
||||
test('clears the contents', () {
|
||||
expect(index.count, 3);
|
||||
index.clear();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue