From c3cc52087fb46e7898e9099945667204e40befbc Mon Sep 17 00:00:00 2001 From: genotrance Date: Thu, 12 Apr 2018 06:59:14 -0500 Subject: Added a few useful os calls to VM (#7440) --- tests/vm/tvmmisc.nim | 24 +++++++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-) (limited to 'tests/vm') 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 -- cgit 1.4.1-2-gfad0 ions/ttablesref.nim?h=devel'>log tree commit diff stats
path: root/tests/collections/ttablesref.nim
blob: b57aedf4a84369c71d7a72fdaeb17a24017a5a5d (plain) (blame)
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
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137