forked from ObjectProfile/PythonBridge
-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathPBRMessageTest.class.st
More file actions
51 lines (46 loc) · 1.35 KB
/
PBRMessageTest.class.st
File metadata and controls
51 lines (46 loc) · 1.35 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
Class {
#name : #PBRMessageTest,
#superclass : #TestCase,
#category : #'PythonBridge-Platform-Messages'
}
{ #category : #tests }
PBRMessageTest >> stubDict [
^ {#type -> #RSTUB .
#ivar1 -> #foo .
#ivar2f -> 3 .
#ivar2r -> #(#bar) .
#__sync -> 'ab45d3'
} asDictionary
]
{ #category : #tests }
PBRMessageTest >> testDecodeRMessage [
| msg |
msg := LanguageLinkRMessage decodeFrom: { #type -> #RMSG } asDictionary.
self assert: msg class equals: LanguageLinkRMessage.
self assert: msg type equals: #RMSG
]
{ #category : #tests }
PBRMessageTest >> testDecodeRStubMessage [
| msg |
msg := LanguageLinkRStubMessage decodeFrom: self stubDict.
self assert: msg ivar1 equals: #foo.
self assert: msg ivar2 equals: #(3 #bar).
self assert: msg syncId equals: 'ab45d3'
]
{ #category : #tests }
PBRMessageTest >> testEncodeRAnswer [
| msg ans |
msg := LanguageLinkRSyncMessage decodeFrom: { #type -> #RSYNC . #__sync -> 'abcde1234' } asDictionary.
ans := msg createAnswer.
self assert: ans syncId equals: 'abcde1234'.
self assert: ans encode equals: { #type -> #RSYNC . #__sync -> 'abcde1234' } asDictionary
]
{ #category : #tests }
PBRMessageTest >> testEncodeRStubAnswer [
| msg ans |
msg := LanguageLinkRStubMessage decodeFrom: self stubDict.
ans := msg createAnswer.
ans ivar1: #foo.
ans ivar2: #(3 #bar).
self assert: ans encode equals: self stubDict
]