forked from ObjectProfile/PythonBridge
-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathPBMessageTest.class.st
More file actions
62 lines (56 loc) · 1.44 KB
/
PBMessageTest.class.st
File metadata and controls
62 lines (56 loc) · 1.44 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
53
54
55
56
57
58
59
60
61
62
Class {
#name : #PBMessageTest,
#superclass : #TestCase,
#category : #'PythonBridge-Platform-Messages'
}
{ #category : #tests }
PBMessageTest >> stubMessage [
^ LanguageLinkStubMessage new
ivar1: #foo;
ivar2: #(3 #bar);
yourself
]
{ #category : #tests }
PBMessageTest >> testDecodeAnswer [
| msg dict ans |
msg := self stubMessage.
dict := {
(#type -> #STUB).
(#ivar1 -> #foo).
(#ivar2f -> 3).
(#ivar2r -> #(#zork)).
(#__sync -> msg syncId)} asDictionary.
ans := msg createAnswer decode: dict.
self assert: ans ivar1 equals: #foo.
self assert: ans ivar2 equals: #(3 #zork).
]
{ #category : #tests }
PBMessageTest >> testDecodeBaseMessage [
self
assert: (LanguageLinkSyncMessage new createAnswer decode: { #type -> #MSG } asDictionary) class
equals: LanguageLinkAnswer
]
{ #category : #tests }
PBMessageTest >> testEncodeBaseMessage [
self
assert: LanguageLinkMessage new encode
equals: { #type -> #MSG } asDictionary
]
{ #category : #tests }
PBMessageTest >> testEncodeMessage [
| msg dict |
msg := self stubMessage.
dict := {
(#type -> #STUB).
(#ivar1 -> #foo).
(#ivar2f -> 3).
(#ivar2r -> #(#bar)).
(#__sync -> msg syncId)} asDictionary.
self assert: msg encode equals: dict
]
{ #category : #tests }
PBMessageTest >> testNoDuplicatedTypes [
| messageClasses |
messageClasses := LanguageLinkAbstractMessage allSubclasses.
self assert: (messageClasses collect: #type) asSet size equals: messageClasses size
]