To protect your data, the CISO officer has suggested users to enable GitLab 2FA as soon as possible.

Commit d2d33e9e authored by Stefan Marr's avatar Stefan Marr
Browse files

Added unit test for basic String functions


Signed-off-by: default avatarStefan Marr <git@stefan-marr.de>
parent 92acae04
StringTest = (
run: harness = (
| str |
str := '1234567890'.
str = '1234567890' ifFalse: [
harness fail: self because: '#= gives wrong result for literals'].
str length = 10 ifFalse: [
harness fail: self because: '#length gives wrong result'].
str + str = '12345678901234567890' ifFalse: [
harness fail: self because: '#+ gives wrong result'].
(str charAt: 1) = '1' ifFalse: [
harness fail: self because: '#charAt: gives wrong result. Expected 1, got: ' + (str charAt: 1)].
(str charAt: 7) = '7' ifFalse: [
harness fail: self because: '#charAt: gives wrong result'].
(str beginsWith: '23') ifTrue: [
harness fail: self because: '#beginsWith: gives wrong result'].
(str beginsWith: '123') ifFalse: [
harness fail: self because: '#beginsWith: gives wrong result'].
(str substringFrom: 2 to: 4) = '234' ifFalse: [
harness fail: self because: '#substringFrom:to: gives wrong result'].
)
)
\ No newline at end of file
......@@ -43,6 +43,7 @@ TestHarness = (
SuperTest,
SymbolTest,
VectorTest,
StringTest,
BlockTest
)
......
......@@ -24,6 +24,7 @@ class SomTest(unittest.TestCase):
("SelfBlock" ,),
("Super" ,),
("String" ,),
("Symbol" ,),
("Vector" ,)])
def test_som_test(self, test_name):
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment