summary refs log tree commit diff stats
path: root/tests/vm
diff options
context:
space:
mode:
authorgenotrance <dev@genotrance.com>2018-04-12 06:59:14 -0500
committerAndreas Rumpf <rumpf_a@web.de>2018-04-12 13:59:14 +0200
commitc3cc52087fb46e7898e9099945667204e40befbc (patch)
treef655aaebac559f680d8d02431ae996e55ab23c17 /tests/vm
parent84982e5e1787d0b3c36ae185c5c75f7764543054 (diff)
downloadNim-c3cc52087fb46e7898e9099945667204e40befbc.tar.gz
Added a few useful os calls to VM (#7440)
Diffstat (limited to 'tests/vm')
-rw-r--r--tests/vm/tvmmisc.nim24
1 files changed, 21 insertions, 3 deletions
diff --git a/tests/vm/tvmmisc.nim b/tests/vm/tvmmisc.nim
index 42a58fa8f..472660bc2 100644
--- a/tests/vm/tvmmisc.nim
+++ b/tests/vm/tvmmisc.nim
@@ -1,5 +1,8 @@
 # bug #4462
 import macros
+import os
+import ospaths
+import strutils
 
 block:
   proc foo(t: typedesc) {.compileTime.} =
@@ -18,7 +21,7 @@ block:
 # #6379
 static:
   import algorithm
-  
+
   var numArray = [1, 2, 3, 4, -1]
   numArray.sort(cmp)
   assert numArray == [-1, 1, 2, 3, 4]
@@ -57,10 +60,25 @@ block:
     result = @[0]
     result.setLen(2)
     var tmp: int
-      
-    for i in 0 .. <2:
+
+    for i in 0 ..< 2:
       inc tmp
       result[i] = tmp
 
   const fact1000 = abc()
   assert fact1000 == @[1, 2]
+
+# Tests for VM ops
+block:
+  static:
+    assert "vm" in getProjectPath()
+
+    let b = getEnv("UNSETENVVAR")
+    assert b == ""
+    assert existsEnv("UNSERENVVAR") == false
+    putEnv("UNSETENVVAR", "VALUE")
+    assert getEnv("UNSETENVVAR") == "VALUE"
+    assert existsEnv("UNSETENVVAR") == true
+
+    assert fileExists("MISSINGFILE") == false
+    assert dirExists("MISSINGDIR") == false