X Tutup
Skip to content

Commit d05db98

Browse files
committed
Add unit tests for string methods
1 parent a0cbf94 commit d05db98

File tree

5 files changed

+49
-0
lines changed

5 files changed

+49
-0
lines changed
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
file library
2+
doSilently: aBlock
3+
"Suspend all notifications value evaluating the given block."
4+
^ aBlock value
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
running
2+
runCase
3+
GRPlatform current doSilently: [ super runCase ]
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
private
2+
supportsUnicode
3+
"dynamically try to figure out whether the current dialect supports Unicode"
4+
^ [
5+
String
6+
with: (Character value: 16r1F1F3)
7+
with: (Character value: 16r1F1F1).
8+
true
9+
] on: Error
10+
do: [ :error | false ]
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
tests-file library
2+
testCompileAsciiString
3+
| selector expected source |
4+
5+
self supportsUnicode ifFalse: [
6+
^ self ].
7+
8+
selector := #stringMethod.
9+
expected := 'test ok'.
10+
source := GRPlatform current asMethodReturningString: expected named: selector.
11+
[
12+
| actual |
13+
GRPlatform current compile: source into: self class classified: 'private'.
14+
actual := self perform: selector.
15+
self assert: expected = actual
16+
] ensure: [
17+
GRPlatform current removeSelector: #stringMethod from: self class ]
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
tests-file library
2+
testCompileUnicodeString
3+
| selector expected source |
4+
selector := #stringMethod.
5+
expected := String
6+
with: (Character value: 16r1F1F3)
7+
with: (Character value: 16r1F1F1).
8+
source := GRPlatform current asMethodReturningString: expected named: selector.
9+
[
10+
| actual |
11+
GRPlatform current compile: source into: self class classified: 'private'.
12+
actual := self perform: selector.
13+
self assert: expected = actual
14+
] ensure: [
15+
GRPlatform current removeSelector: #stringMethod from: self class ]

0 commit comments

Comments
 (0)
X Tutup