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

StringTest.som 1.12 KB
Newer Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
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: [
22
            harness fail: self because: '#beginsWith: gives wrong result (case 1)'].
23
        (str beginsWith: '123') ifFalse: [
24
            harness fail: self because: '#beginsWith: gives wrong result (case 2)'].
25
26
27
28
29
30
        
        (str substringFrom: 2 to: 4) = '234' ifFalse: [
            harness fail: self because: '#substringFrom:to: gives wrong result'].
    )

)