mirror of
https://github.com/SkinnyMind/libgit2dart.git
synced 2025-06-23 01:09:27 -04:00
docs: improve api documentation
This commit is contained in:
parent
199dce111a
commit
a24070c44c
32 changed files with 1008 additions and 518 deletions
|
@ -175,7 +175,7 @@ void main() {
|
|||
repo: repo,
|
||||
message: message,
|
||||
author: author,
|
||||
commiter: commiter,
|
||||
committer: commiter,
|
||||
tree: tree,
|
||||
parents: [parent1, parent2],
|
||||
);
|
||||
|
|
|
@ -37,12 +37,12 @@ void main() {
|
|||
|
||||
test('returns index entry at provided position', () {
|
||||
expect(index[3].path, 'file');
|
||||
expect(index[3].sha, fileSha);
|
||||
expect(index[3].oid.sha, fileSha);
|
||||
});
|
||||
|
||||
test('returns index entry at provided path', () {
|
||||
expect(index['file'].path, 'file');
|
||||
expect(index['file'].sha, fileSha);
|
||||
expect(index['file'].oid.sha, fileSha);
|
||||
});
|
||||
|
||||
test('throws if provided entry position is out of bounds', () {
|
||||
|
@ -93,13 +93,13 @@ void main() {
|
|||
final entry = index['file'];
|
||||
|
||||
index.add(entry);
|
||||
expect(index['file'].sha, fileSha);
|
||||
expect(index['file'].oid.sha, fileSha);
|
||||
expect(index.length, 4);
|
||||
});
|
||||
|
||||
test('successfully adds with provided path string', () {
|
||||
index.add('file');
|
||||
expect(index['file'].sha, fileSha);
|
||||
expect(index['file'].oid.sha, fileSha);
|
||||
expect(index.length, 4);
|
||||
});
|
||||
|
||||
|
@ -155,21 +155,21 @@ void main() {
|
|||
index.addAll(['file', 'feature_file']);
|
||||
|
||||
expect(index.length, 2);
|
||||
expect(index['file'].sha, fileSha);
|
||||
expect(index['feature_file'].sha, featureFileSha);
|
||||
expect(index['file'].oid.sha, fileSha);
|
||||
expect(index['feature_file'].oid.sha, featureFileSha);
|
||||
|
||||
index.clear();
|
||||
index.addAll(['[f]*']);
|
||||
|
||||
expect(index.length, 2);
|
||||
expect(index['file'].sha, fileSha);
|
||||
expect(index['feature_file'].sha, featureFileSha);
|
||||
expect(index['file'].oid.sha, fileSha);
|
||||
expect(index['feature_file'].oid.sha, featureFileSha);
|
||||
|
||||
index.clear();
|
||||
index.addAll(['feature_f???']);
|
||||
|
||||
expect(index.length, 1);
|
||||
expect(index['feature_file'].sha, featureFileSha);
|
||||
expect(index['feature_file'].oid.sha, featureFileSha);
|
||||
});
|
||||
|
||||
test('throws when trying to addAll in bare repository', () {
|
||||
|
|
|
@ -54,8 +54,7 @@ void main() {
|
|||
|
||||
repo.createStash(
|
||||
stasher: stasher,
|
||||
includeUntracked: true,
|
||||
includeIgnored: true,
|
||||
flags: {GitStash.includeUntracked, GitStash.includeIgnored},
|
||||
);
|
||||
expect(repo.status.isEmpty, true);
|
||||
expect(swpPath.existsSync(), false);
|
||||
|
@ -72,7 +71,7 @@ void main() {
|
|||
final index = repo.index;
|
||||
index.add('file');
|
||||
|
||||
repo.createStash(stasher: stasher, keepIndex: true);
|
||||
repo.createStash(stasher: stasher, flags: {GitStash.keepIndex});
|
||||
expect(repo.status.isEmpty, false);
|
||||
expect(repo.stashes.length, 1);
|
||||
|
||||
|
@ -111,7 +110,7 @@ void main() {
|
|||
index.add('stash.this');
|
||||
expect(index.find('stash.this'), true);
|
||||
|
||||
repo.createStash(stasher: stasher, includeUntracked: true);
|
||||
repo.createStash(stasher: stasher, flags: {GitStash.includeUntracked});
|
||||
expect(repo.status.isEmpty, true);
|
||||
expect(index.find('stash.this'), false);
|
||||
|
||||
|
@ -204,7 +203,7 @@ void main() {
|
|||
index.add('stash.this');
|
||||
expect(index.find('stash.this'), true);
|
||||
|
||||
repo.createStash(stasher: stasher, includeUntracked: true);
|
||||
repo.createStash(stasher: stasher, flags: {GitStash.includeUntracked});
|
||||
expect(repo.status.isEmpty, true);
|
||||
expect(index.find('stash.this'), false);
|
||||
|
||||
|
@ -252,7 +251,7 @@ void main() {
|
|||
|
||||
test('returns string representation of Stash object', () {
|
||||
File('${tmpDir.path}/stash.this').writeAsStringSync('stash');
|
||||
repo.createStash(stasher: stasher, includeUntracked: true);
|
||||
repo.createStash(stasher: stasher, flags: {GitStash.includeUntracked});
|
||||
expect(repo.stashes[0].toString(), contains('Stash{'));
|
||||
});
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue