all repos — min @ snap

A small but practical concatenative programming language.

tests/sys.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
 67
 68
 69
 70
 71
 72
 73
 74
'test load
'test import

"sys" describe

  ("dir1" mkdir "dir1" dir?) assert

  ("dir1" "dir2" mv "dir2" dir?) assert

  ("dir1" dir? false ==) assert

  ("dir2" "dir1" cp "dir1" dir?) assert

  ("..." "dir1/test.txt" fwrite "dir1/test.txt" file?) assert

  ("dir1/test.txt" "dir2" mv "dir2/test.txt" file?)  assert

  ("dir1/test.txt" file? false ==) assert

  ("dir2/test.txt" "dir1" cp "dir1/test.txt" file?)  assert

  ('dir1 ls 'filename map ("test.txt") ==) assert

  ('dir2 ls 'dirname map ("dir2") ==) assert

  ('dir1 rmdir 'dir2 rmdir 'dir1 dir? 'dir2 dir? or false ==) assert  

  ("systest" mkdir . ls (. "systest") => "/" join in?) assert

  ("systest" cd . "systest" match) assert
  .. cd

  ("./min -v" & 'output dget "\." match) assert

  ("PATH" env?) assert

  ($PATH length 0 >) assert

  ("TEST" "AAA" put-env $AAA "TEST" ==) assert

  (os length 0 >) assert

  (cpu length 0 >) assert

  ("TEST" "test.txt" fwrite "test.txt" file?) assert

  ("systest" exists?) assert

  ("systest" dir?) assert

  ("test.txt" "test2.txt" cp "test2.txt" file?) assert

  ("test.txt" "test1.txt" mv "test1.txt" file?) assert

  ("test2.txt" rm "test1.txt" rm . ls (. "test1.txt") => "/" join in? :t1 . ls "test2" in? t1 and false ==) assert

  ("systest" cd 
   "TEST" "test.txt" fwrite
   "TEST1" "test1.txt" fwrite
   "TEST2" "test2.txt" fwrite
   "TEST3" "test3.txt" fwrite
   . ls "test.zip" zip . ls (. "test.zip") => "/" join in?) assert

   ("test.zip" "extracted" unzip "extracted" ls "extracted/test1.txt" in?) assert

  .. cd

  ("systest" rmdir . ls (. "systest") => "/" join in? false ==) assert

  

  report
  clear-stack
  "systest" rmdir