all repos — min @ 9616781b776e00ddc7c55ac6a43ca78254fc3eb9

A small but practical concatenative programming language.

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
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
'test include

"str" describe
  
  (" test   " strip "test" ==) assert

  ("a,b,c" "," split ("a" "b" "c") ==) 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

  ("MiNiM is a concatenative programming language" "/^minim/i" =~ ("MiNiM") ==) 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

  (3 string "3" ==) assert
  
  ("false" bool false ==) assert
  
  ("" bool false ==) assert
  
  (0 bool false ==) assert
  
  (false bool false ==) assert
  
  (0.0 bool false ==) assert
  
  ("something" bool true ==) assert

  ("345" int 345 ==) assert

  (true int 1 ==) assert

  (3.5 int 3 ==) assert

  (3.5 float 3.5 ==) assert

  (3 float 3.0 ==) assert

  (false float 0.0 ==) assert

  ("3.678" float 3.678 ==) assert

  report
  clear-stack