forked from ObjectProfile/PythonBridge
-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathPBCommandFactoryTest.class.st
More file actions
52 lines (47 loc) · 1.55 KB
/
PBCommandFactoryTest.class.st
File metadata and controls
52 lines (47 loc) · 1.55 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
Class {
#name : #PBCommandFactoryTest,
#superclass : #TestCase,
#instVars : [
'factory'
],
#category : #'PythonBridge-Tests'
}
{ #category : #initialization }
PBCommandFactoryTest >> setUp [
factory := PBCommandFactory new
]
{ #category : #tests }
PBCommandFactoryTest >> testBuildEmptyCommand [
| command |
command := factory buildCommand.
self assert: command instructions size equals: 1.
self assert: command instructions first class equals: P3GCall.
self assert: command instructions first target name equals: 'notify'.
self assert: command instructions first positionalArguments first equals: nil.
self assert: command bindings isEmpty
]
{ #category : #tests }
PBCommandFactoryTest >> testBuildFullCommand [
| command instructions |
factory << (P3GString string: 'foo').
factory bindingAt: #myVar put: 3.
command := factory buildCommand.
instructions := command instructions.
self assert: command instructions first positionalArguments first string equals: 'foo'.
self assert: (command bindingsDictionary at: #myVar) equals: 3
]
{ #category : #tests }
PBCommandFactoryTest >> testBuildSimpleCommand [
| command instructions |
factory << (P3GString string: 'foo').
command := factory buildCommand.
instructions := command instructions.
self assert: command instructions first positionalArguments first string equals: 'foo'.
]
{ #category : #tests }
PBCommandFactoryTest >> testBuildWithObservers [
| command |
factory observerFromCallback: [ 32 ].
command := factory buildCommand.
self assert: command observers first callback value equals: 32.
]