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 |
'min-test require :test ;;; "sys" test.describe ("dir1" sys.mkdir "dir1" fs.dir?) test.assert ("dir1" "dir2" sys.mv "dir2" fs.dir?) test.assert ("dir1" fs.dir? false ==) test.assert ("dir2" "dir1" sys.cp "dir1" fs.dir?) test.assert ("..." "dir1/test.txt" fs.write "dir1/test.txt" fs.file?) test.assert ("dir1/test.txt" "dir2" sys.mv "dir2/test.txt" fs.file?) test.assert ("dir1/test.txt" fs.file? false ==) test.assert ("dir2/test.txt" "dir1" sys.cp "dir1/test.txt" fs.file?) test.assert ('dir1 sys.ls 'fs.filename map ("test.txt") ==) test.assert ('dir2 sys.ls 'fs.dirname map ("dir2") ==) test.assert ('dir1 sys.rmdir 'dir2 sys.rmdir 'dir1 fs.dir? 'dir2 fs.dir? or false ==) test.assert ("systest" sys.mkdir sys.pwd sys.ls (sys.pwd "systest") => "/" join in?) test.assert ("systest" sys.cd sys.pwd "systest" match?) test.assert sys.parent-dir sys.cd ("./min -v" sys.run 'output dict.get "\\." match?) test.assert ("PATH" sys.env?) test.assert ($PATH length 0 >) test.assert ("TEST" "AAA" put-env $AAA "TEST" ==) test.assert (sys.os length 0 >) test.assert (sys.cpu length 0 >) test.assert ("TEST" "test.txt" fs.write "test.txt" fs.file?) test.assert ("test.txt" "test2.txt" sys.cp "test2.txt" fs.file?) test.assert ("test.txt" "test1.txt" sys.mv "test1.txt" fs.file?) test.assert ("test2.txt" sys.rm "test1.txt" sys.rm sys.pwd sys.ls (sys.pwd "test1.txt") => "/" join in? :t1 sys.pwd sys.ls "test2" in? t1 and false ==) test.assert ("systest" sys.cd "TEST" "test.txt" fs.write "TEST1" "test1.txt" fs.write "TEST2" "test2.txt" fs.write "TEST3" "test3.txt" fs.write sys.pwd sys.ls "test.zip" sys.zip sys.pwd sys.ls (sys.pwd "test.zip") => "/" join in?) test.assert ("test.zip" "extracted" sys.unzip "extracted" sys.ls "extracted/test1.txt" in?) test.assert sys.parent-dir sys.cd ("systest" sys.rmdir sys.pwd sys.ls (sys.pwd "systest") => "/" join in? false ==) test.assert ([ls] "ls" sys.run "output" dict.get ==) test.assert test.report stack.clear "systest" sys.rmdir |