Skip to content

Commit

Permalink
refactor: use explicit type parameters in tests/example
Browse files Browse the repository at this point in the history
Signed-off-by: SphericalKat <[email protected]>
  • Loading branch information
SphericalKat committed Apr 6, 2021
1 parent db4cdfd commit ffcac28
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ class TestContainer {
TestContainer(this.innerVal);
}
extractOne(
extractOne<TestContainer>(
query: 'cowboys',
choices: [
'Atlanta Falcons',
Expand All @@ -144,6 +144,6 @@ extractOne(
'Dallas Cowboys'
].map((e) => TestContainer(e)).toList(),
cutoff: 10,
getter: (TestContainer x) => x.innerVal
getter: (x) => x.innerVal
).toString(); // (string Dallas Cowboys, score: 90, index: 3)
```
16 changes: 8 additions & 8 deletions test/fuzzywuzzy_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ void main() {
});

test('extract top with a non-string collection', () {
final result = extractTop(
final result = extractTop<TestContainer>(
query: 'goolge',
choices: [
'google',
Expand All @@ -98,7 +98,7 @@ void main() {
].map((e) => TestContainer(e)).toList(),
limit: 4,
cutoff: 50,
getter: (TestContainer x) => x.innerVal).toString();
getter: (x) => x.innerVal).toString();
expect(result,
'[(string google, score: 83, index: 0), (string googleplus, score: 75, index: 5)]');
});
Expand All @@ -123,7 +123,7 @@ void main() {

test('extract all sorted returns appropriate values for generic container',
() {
final result = extractAllSorted(
final result = extractAllSorted<TestContainer>(
query: 'goolge',
choices: [
'google',
Expand All @@ -136,7 +136,7 @@ void main() {
'plexoogl'
].map((e) => TestContainer(e)).toList(),
cutoff: 10,
getter: (TestContainer x) => x.innerVal,
getter: (x) => x.innerVal,
).toString();
expect(result,
'[(string google, score: 83, index: 0), (string googleplus, score: 75, index: 5), (string plexoogl, score: 43, index: 7), (string bingnews, score: 29, index: 6), (string linkedin, score: 29, index: 3), (string facebook, score: 29, index: 2), (string bing, score: 23, index: 1), (string twitter, score: 15, index: 4)]');
Expand All @@ -162,7 +162,7 @@ void main() {
});

test('extract all returns appropriate values for generic container', () {
final result = extractAll(
final result = extractAll<TestContainer>(
query: 'goolge',
choices: [
'google',
Expand All @@ -175,7 +175,7 @@ void main() {
'plexoogl'
].map((e) => TestContainer(e)).toList(),
cutoff: 10,
getter: (TestContainer x) => x.innerVal,
getter: (x) => x.innerVal,
).toString();
expect(result,
'[(string google, score: 83, index: 0), (string bing, score: 23, index: 1), (string facebook, score: 29, index: 2), (string linkedin, score: 29, index: 3), (string twitter, score: 15, index: 4), (string googleplus, score: 75, index: 5), (string bingnews, score: 29, index: 6), (string plexoogl, score: 43, index: 7)]');
Expand All @@ -196,7 +196,7 @@ void main() {
});

test('extract one returns appropriate values for generic container', () {
final result = extractOne(
final result = extractOne<TestContainer>(
query: 'cowboys',
choices: [
'Atlanta Falcons',
Expand All @@ -205,7 +205,7 @@ void main() {
'Dallas Cowboys'
].map((e) => TestContainer(e)).toList(),
cutoff: 10,
getter: (TestContainer x) => x.innerVal
getter: (x) => x.innerVal
).toString();
expect(result, '(string Dallas Cowboys, score: 90, index: 3)');
});
Expand Down

0 comments on commit ffcac28

Please sign in to comment.