tests/str.min
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 |
'test load 'test import "str" describe ("$1 - $2 - $3" (1 true "test") interpolate "1 - true - test" ==) assert ("$1 + $2 = $3" (2 2 (2 2 +)) apply interpolate "2 + 2 = 4" ==) assert (" test " strip "test" ==) assert ("test" length 4 ==) assert ("a,b,c" "," split ("a" "b" "c") ==) assert ("abc" "" split ("a" "b" "c") ==) assert ("This is a test" 5 2 substr "is" ==) assert ("this" 2 3 substr "is" ==) assert ("This is a test" "is" indexof 2 ==) assert ("test #1" "[0-9]" search ("1") ==) assert ("This is test #1" "test #([0-9])" search ("test #1" "1") ==) assert ("This is a random string" "random" match true ==) assert ("something is not something else" "some" "any" replace "anything is not anything else" ==) assert ("MiN is a concatenative programming language" "/^min/i" =~ ("MiN") ==) assert ("This is a difficult test" "s/difficult/simple/" =~ ("This is a simple test") ==) assert ("This is a DIFFICULT\n test" "s/difficult/simple/mis" =~ ("This is a simple\n test") ==) assert ("this is a test" uppercase "THIS IS A TEST" ==) assert ("THIS IS A TEST" lowercase "this is a test" ==) assert ("test" capitalize "Test" ==) assert ("this is a test" titleize "This Is A Test" ==) assert ("+" 3 repeat "+++" ==) assert ("test" 4 indent " test" ==) assert ((1 3 "test") ", " join "1, 3, test" ==) assert report clear-stack |