Skip to content

Commit

Permalink
NECControllerTest:
Browse files Browse the repository at this point in the history
- change the class to test to CompletionController
- rename to CompletionControllerTest

change references to NEController to use CompletionController instead in Rubric

Delete NECUntypedModelTest (it is testing internal things of the old model)
  • Loading branch information
MarcusDenker committed Oct 17, 2019
1 parent 5ac3874 commit c79ef80
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 249 deletions.
Expand Up @@ -2,7 +2,7 @@
A NECControllerTest is a test class for testing the behavior of NECController
"
Class {
#name : #NECControllerTest,
#name : #CompletionControllerTest,
#superclass : #TestCase,
#instVars : [
'controller',
Expand All @@ -12,17 +12,17 @@ Class {
}

{ #category : #'tests-keyboard' }
NECControllerTest >> allSelfClosingCharacters [
CompletionControllerTest >> allSelfClosingCharacters [
^ {'{}' . '[]' . '()' . '<>' . '||' . '""' . ''''''}
]

{ #category : #'tests-keyboard' }
NECControllerTest >> allSmartCharacters [
CompletionControllerTest >> allSmartCharacters [
^ self allSelfClosingCharacters , { '||'. '<>' }
]

{ #category : #'tests-keyboard' }
NECControllerTest >> keyboardEventFor: char [
CompletionControllerTest >> keyboardEventFor: char [

| event |
event := KeyboardEvent new.
Expand All @@ -39,39 +39,39 @@ NECControllerTest >> keyboardEventFor: char [
]

{ #category : #'tests-keyboard' }
NECControllerTest >> selectAll [
CompletionControllerTest >> selectAll [
editor selectAll
]

{ #category : #'tests-keyboard' }
NECControllerTest >> selectAt: anIndex [
CompletionControllerTest >> selectAt: anIndex [
editor selectFrom: anIndex to: anIndex - 1
]

{ #category : #'tests-keyboard' }
NECControllerTest >> selectFrom: start to: stop [
CompletionControllerTest >> selectFrom: start to: stop [
editor selectFrom: start to: stop
]

{ #category : #'tests-keyboard' }
NECControllerTest >> setEditorText: aString [
CompletionControllerTest >> setEditorText: aString [
editor selectAll; addString: aString

]

{ #category : #running }
NECControllerTest >> setUp [
CompletionControllerTest >> setUp [
"Setting up code for NECControllerTest"

super setUp.

editor := RubTextEditor forTextArea: RubTextFieldArea new.
controller := NECController new.
controller := CompletionController new.
controller setEditor: editor
]

{ #category : #running }
NECControllerTest >> tearDown [
CompletionControllerTest >> tearDown [
"Tearing down code for NECControllerTest"

controller := nil.
Expand All @@ -80,7 +80,7 @@ NECControllerTest >> tearDown [
]

{ #category : #'tests-keyboard' }
NECControllerTest >> testSmartBackspace [
CompletionControllerTest >> testSmartBackspace [
"Pressing backspace inside paired smart characters should remove both of them"
self allSmartCharacters
do: [ :chars |
Expand All @@ -94,7 +94,7 @@ NECControllerTest >> testSmartBackspace [
]

{ #category : #'tests-keyboard' }
NECControllerTest >> testSmartBackspaceOutsideSmartCharacters [
CompletionControllerTest >> testSmartBackspaceOutsideSmartCharacters [

self setEditorText: '.[];'; selectAll.
self selectAt: 2.
Expand All @@ -110,7 +110,7 @@ NECControllerTest >> testSmartBackspaceOutsideSmartCharacters [
]

{ #category : #'tests-keyboard' }
NECControllerTest >> testSmartBackspaceWithSelection [
CompletionControllerTest >> testSmartBackspaceWithSelection [

self setEditorText: 'Hello'; selectAll.
self assert: controller smartBackspace not description: 'No smartbackspace if selection'.
Expand All @@ -123,7 +123,7 @@ NECControllerTest >> testSmartBackspaceWithSelection [
]

{ #category : #'tests-keyboard' }
NECControllerTest >> testSmartCharacterPairForIfAbsent [
CompletionControllerTest >> testSmartCharacterPairForIfAbsent [

"Check leading smart character has matching trailing character - e.g. { and }"
self allSmartCharacters do: [ :pairs |
Expand All @@ -138,7 +138,7 @@ NECControllerTest >> testSmartCharacterPairForIfAbsent [
]

{ #category : #'tests-keyboard' }
NECControllerTest >> testSmartCharacterWithEventAndSelection [
CompletionControllerTest >> testSmartCharacterWithEventAndSelection [
"Test we surround selected text with smart characters properly"
self
setEditorText: ' text ';
Expand All @@ -162,7 +162,7 @@ NECControllerTest >> testSmartCharacterWithEventAndSelection [
]

{ #category : #'tests-keyboard' }
NECControllerTest >> testSmartCharacterWithEventSelfClosing [
CompletionControllerTest >> testSmartCharacterWithEventSelfClosing [
self
setEditorText: ' ';
selectAt: 2.
Expand All @@ -187,7 +187,7 @@ NECControllerTest >> testSmartCharacterWithEventSelfClosing [
]

{ #category : #'tests-keyboard' }
NECControllerTest >> testSmartCharactersOppositeOf [
CompletionControllerTest >> testSmartCharactersOppositeOf [

self allSmartCharacters
do: [ :pairs |
Expand All @@ -197,15 +197,15 @@ NECControllerTest >> testSmartCharactersOppositeOf [
]

{ #category : #'tests-keyboard' }
NECControllerTest >> testSmartCharactersShouldClose [
CompletionControllerTest >> testSmartCharactersShouldClose [
"Some smart characters shouldn't auto close, ohers not"
self assert: (controller smartCharacterShouldClose: $() equals: true.
self assert: (controller smartCharacterShouldClose: $<) equals: false.

]

{ #category : #'tests-keyboard' }
NECControllerTest >> testSmartNeedExtraRemoveInForOppositeAt [
CompletionControllerTest >> testSmartNeedExtraRemoveInForOppositeAt [

self assert: (controller smartNeedExtraRemoveIn: '()' for: $( opposite:$) at:1).
self deny: (controller smartNeedExtraRemoveIn: '(()' for: $( opposite:$) at:2).
Expand Down
221 changes: 0 additions & 221 deletions src/NECompletion-Tests/NECUntypedModelTest.class.st

This file was deleted.

2 changes: 1 addition & 1 deletion src/NECompletion/CompletionProducerVisitor.class.st
Expand Up @@ -122,7 +122,7 @@ CompletionProducerVisitor >> visitVariableNode: aRBVariableNode [
(self select: (lookupClass allSlots collect: [ :each | each name ]) beginningWith: aRBVariableNode name),
(self select: aRBVariableNode methodNode temporaryNames beginningWith: aRBVariableNode name),
(self select: aRBVariableNode methodNode argumentNames beginningWith: aRBVariableNode name),
(self select: lookupClass allClassVarNames beginningWith: aRBVariableNode name),
(self select: lookupClass allClassVarNames asOrderedCollection beginningWith: aRBVariableNode name),
(self select: (lookupClass allSharedPools flatCollect: [ :each | each classVarNames]) beginningWith: aRBVariableNode name)

]

0 comments on commit c79ef80

Please sign in to comment.