all repos — min @ a82d0c84bcb1727bccc1f0ab1a252d7762d1d028

A small but practical concatenative programming language.

tests/fs.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
'min-test require :test
;;;

"fs" test.describe
  "TEST" "test.txt" fs.write
 
  ("test.txt" fs.size 4 ==) test.assert

  ("test.txt" fs.permissions 644 >=) test.assert

  ("test.txt" fs.type "file" ==) test.assert

  ("test.txt" fs.hidden? false ==) test.assert

  ("test.txt" fs.stats 'type dget "file" ==) test.assert

  ("tests" fs.dir?) test.assert

  ("tests" fs.exists?) test.assert

  ("tests/fs.min" fs.file?) test.assert

  (("a" "b" "c") fs.join-path "a/b/c" ==) test.assert

  ("/home/h3rald" fs.windows-path "\\home\\h3rald" ==) test.assert

  ("/home/h3rald" fs.absolute-path?) test.assert

  ("tests/sys.min" fs.expand-filename fs.unix-path pwd "/tests/sys.min" suffix fs.unix-path ==) test.assert

  ("./../tests" fs.normalized-path fs.unix-path "../tests" ==) test.assert

  ((pwd "tests/global.min") => fs.join-path pwd fs.relative-path fs.unix-path "tests/global.min" ==) test.assert

  ("tests/global.min" fs.absolute-path fs.unix-path (pwd "tests/global.min") => fs.join-path fs.unix-path ==) test.assert

  ("./test" fs.absolute-path? not) test.assert

  ("c:/windows" fs.windows-path "c:\\windows" ==)  test.assert

  ("TEST" "test.txt" fs.write
  "test.txt" fs.read "TEST" ==) test.assert

  (" - TEST" "test.txt" fs.append
  "test.txt" fs.read "TEST - TEST" ==) test.assert

  test.report
  stack.clear
  "test.txt" rm