-
Notifications
You must be signed in to change notification settings - Fork 54
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #656 from hernanmd/NewFinder
New Finder
- Loading branch information
Showing
56 changed files
with
4,739 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,105 @@ | ||
Class { | ||
#name : 'StFinderClassTest', | ||
#superclass : 'StFinderTest', | ||
#category : 'NewTools-Finder-Tests-Core', | ||
#package : 'NewTools-Finder-Tests', | ||
#tag : 'Core' | ||
} | ||
|
||
{ #category : 'running' } | ||
StFinderClassTest >> setUp [ | ||
|
||
super setUp. | ||
presenterModel currentSearch: StFinderClassSearch new | ||
|
||
] | ||
|
||
{ #category : 'tests' } | ||
StFinderClassTest >> testSearchForExactCaseInsensitiveStringMissing [ | ||
|
||
self openInstance. | ||
self setExactAndCaseInsensitive. | ||
self doSearch: 'stfindermock'. | ||
|
||
self assertEmpty: presenter resultTree roots. | ||
|
||
] | ||
|
||
{ #category : 'tests' } | ||
StFinderClassTest >> testSearchForExactCaseInsensitiveStringSucess [ | ||
|
||
| results | | ||
|
||
self openInstance. | ||
self setExactAndCaseInsensitive. | ||
self doSearch: 'stfindermockc'. | ||
|
||
results := presenter resultTree roots. | ||
self | ||
assertCollection: (results collect: [ : r | r content name ]) | ||
hasSameElements: #(#StFinderMockC). | ||
] | ||
|
||
{ #category : 'tests' } | ||
StFinderClassTest >> testSearchForExactCaseSensitiveStringMissing [ | ||
|
||
self openInstance. | ||
self setExactAndCaseSensitive. | ||
self doSearch: 'StFinderMock'. | ||
|
||
self assertEmpty: presenter resultTree roots. | ||
|
||
] | ||
|
||
{ #category : 'tests' } | ||
StFinderClassTest >> testSearchForExactCaseSensitiveStringSucess [ | ||
|
||
| results | | ||
|
||
self openInstance. | ||
self setExactAndCaseSensitive. | ||
self doSearch: 'StFinderMockC'. | ||
|
||
results := presenter resultTree roots. | ||
self | ||
assert: results size | ||
equals: 1. | ||
] | ||
|
||
{ #category : 'tests' } | ||
StFinderClassTest >> testSearchForRegexpStartWithCaseInsensitive [ | ||
|
||
| results | | ||
|
||
self openInstance. | ||
self setRegexAndCaseInsensitive. | ||
self doSearch: '^StFinderMock'. | ||
results := presenter resultTree roots. | ||
|
||
self | ||
assertCollection: (results collect: [ : r | r content name ]) | ||
hasSameElements: #(#StFinderMockC #StFinderMocka #StFinderMockB). | ||
] | ||
|
||
{ #category : 'tests' } | ||
StFinderClassTest >> testSearchForRegexpStartWithCaseSensitive [ | ||
|
||
| results | | ||
|
||
self openInstance. | ||
self setRegexAndCaseSensitive. | ||
self doSearch: '^StFinderMockC'. | ||
results := presenter resultTree roots. | ||
self | ||
assert: results size | ||
equals: 1. | ||
] | ||
|
||
{ #category : 'tests' } | ||
StFinderClassTest >> testSubstringSearchNonExistingClass [ | ||
|
||
self openInstance. | ||
self doSearch: 'NonExistingClass'. | ||
|
||
self assertEmpty: presenter resultTree roots | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
Class { | ||
#name : 'StFinderExampleTest', | ||
#superclass : 'StFinderTest', | ||
#category : 'NewTools-Finder-Tests-Core', | ||
#package : 'NewTools-Finder-Tests', | ||
#tag : 'Core' | ||
} | ||
|
||
{ #category : 'running' } | ||
StFinderExampleTest >> setUp [ | ||
|
||
super setUp. | ||
presenterModel currentSearch: StFinderExampleSearch new. | ||
self openInstance. | ||
|
||
] | ||
|
||
{ #category : 'running' } | ||
StFinderExampleTest >> testConcatenationSearch [ | ||
|
||
| results | | ||
|
||
self doSearch: '''a''. ''b''. ''ab'''. | ||
|
||
results := presenter resultTree roots. | ||
self assert: results size equals: 2. | ||
] | ||
|
||
{ #category : 'running' } | ||
StFinderExampleTest >> testFactorialSearch [ | ||
|
||
| results firstResult secondResult | | ||
|
||
self doSearch: '3 . 6'. | ||
|
||
results := presenter resultTree roots. | ||
firstResult := results contents first. | ||
secondResult := results contents second. | ||
|
||
self assert: firstResult content selector equals: #slowFactorial. | ||
self assert: secondResult content selector equals: #factorial. | ||
|
||
] | ||
|
||
{ #category : 'running' } | ||
StFinderExampleTest >> testIndexOfSearch [ | ||
|
||
| results | | ||
|
||
self doSearch: '{2. 4. 5. 1}. 5. 3'. | ||
|
||
results := presenter resultTree roots. | ||
|
||
self assert: (results contents anySatisfy: [ : r | r content selector = #indexOf: ]) | ||
|
||
] | ||
|
||
{ #category : 'running' } | ||
StFinderExampleTest >> testNegatedSearch [ | ||
|
||
| results singleResult | | ||
|
||
self doSearch: '2 . -2'. | ||
|
||
results := presenter resultTree roots. | ||
singleResult := results contents anyOne. | ||
self assert: singleResult content selector equals: #negated. | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
Class { | ||
#name : 'StFinderMockB', | ||
#superclass : 'Object', | ||
#category : 'NewTools-Finder-Tests-Mocks', | ||
#package : 'NewTools-Finder-Tests', | ||
#tag : 'Mocks' | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
" | ||
Class to hold sample selectors to find. | ||
" | ||
Class { | ||
#name : 'StFinderMockC', | ||
#superclass : 'Object', | ||
#category : 'NewTools-Finder-Tests-Mocks', | ||
#package : 'NewTools-Finder-Tests', | ||
#tag : 'Mocks' | ||
} | ||
|
||
{ #category : 'accessing' } | ||
StFinderMockC >> aBCSelectorSearchForRegexpStartWithCase [ | ||
"mock example" | ||
] | ||
|
||
{ #category : 'accessing' } | ||
StFinderMockC >> abcSelectorSearchForRegexpStartWithoutCase [ | ||
"mock example" | ||
] | ||
|
||
{ #category : 'accessing' } | ||
StFinderMockC >> selectorSearchForRegexpWithCaseEndsWithAbc [ | ||
"mock example" | ||
] | ||
|
||
{ #category : 'accessing' } | ||
StFinderMockC >> selectorSearchForRegexpWithoutCaseEndsWithabc [ | ||
"mock example" | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
Class { | ||
#name : 'StFinderMocka', | ||
#superclass : 'Object', | ||
#category : 'NewTools-Finder-Tests-Mocks', | ||
#package : 'NewTools-Finder-Tests', | ||
#tag : 'Mocks' | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,105 @@ | ||
Class { | ||
#name : 'StFinderPackageTest', | ||
#superclass : 'StFinderTest', | ||
#category : 'NewTools-Finder-Tests-Core', | ||
#package : 'NewTools-Finder-Tests', | ||
#tag : 'Core' | ||
} | ||
|
||
{ #category : 'running' } | ||
StFinderPackageTest >> setUp [ | ||
|
||
super setUp. | ||
presenterModel currentSearch: StFinderPackageSearch new | ||
|
||
] | ||
|
||
{ #category : 'tests' } | ||
StFinderPackageTest >> testSearchForExactCaseInsensitiveStringMissing [ | ||
|
||
self openInstance. | ||
self setExactAndCaseInsensitive. | ||
self doSearch: 'newtools-finder'. | ||
|
||
self assertEmpty: presenter resultTree roots. | ||
|
||
] | ||
|
||
{ #category : 'tests' } | ||
StFinderPackageTest >> testSearchForExactCaseInsensitiveStringSucess [ | ||
|
||
| results | | ||
|
||
self openInstance. | ||
self setExactAndCaseInsensitive. | ||
self doSearch: 'newtools-finder-tests'. | ||
|
||
results := presenter resultTree roots. | ||
self | ||
assertCollection: (results collect: [ : r | r content name ]) | ||
hasSameElements: #('NewTools-Finder-Tests'). | ||
] | ||
|
||
{ #category : 'tests' } | ||
StFinderPackageTest >> testSearchForExactCaseSensitiveStringMissing [ | ||
|
||
self openInstance. | ||
self setExactAndCaseSensitive. | ||
self doSearch: 'NewTools-Finder'. | ||
|
||
self assertEmpty: presenter resultTree roots. | ||
|
||
] | ||
|
||
{ #category : 'tests' } | ||
StFinderPackageTest >> testSearchForExactCaseSensitiveStringSucess [ | ||
|
||
| results | | ||
|
||
self openInstance. | ||
self setExactAndCaseSensitive. | ||
self doSearch: 'NewTools-Finder-Tests'. | ||
|
||
results := presenter resultTree roots. | ||
self | ||
assert: results size | ||
equals: 1. | ||
] | ||
|
||
{ #category : 'tests' } | ||
StFinderPackageTest >> testSearchForRegexpStartWithCaseInsensitive [ | ||
|
||
| results | | ||
|
||
self openInstance. | ||
self setRegexAndCaseInsensitive. | ||
self doSearch: '^newTools-finder'. | ||
results := presenter resultTree roots. | ||
|
||
self | ||
assertCollection: (results collect: [ : r | r content name ]) | ||
hasSameElements: #(#'NewTools-Finder-Tests'). | ||
] | ||
|
||
{ #category : 'tests' } | ||
StFinderPackageTest >> testSearchForRegexpStartWithCaseSensitive [ | ||
|
||
| results | | ||
|
||
self openInstance. | ||
self setRegexAndCaseSensitive. | ||
self doSearch: '^NewTools-Finder'. | ||
results := presenter resultTree roots. | ||
self | ||
assert: results size | ||
equals: 1. | ||
] | ||
|
||
{ #category : 'tests' } | ||
StFinderPackageTest >> testSubstringSearchNonExistingPackage [ | ||
|
||
self openInstance. | ||
|
||
self doSearch: 'NonExistingPackage'. | ||
self assertEmpty: presenter resultTree roots | ||
] |
Oops, something went wrong.