summary refs log tree commit diff stats
path: root/tinyc/win32/include/dirent.h
Commit message (Expand)AuthorAgeFilesLines
* TinyC upgrade (#6593)Dmitry Atamanov2017-10-281-69/+108
* Removes executable bit for text files.Grzegorz Adam Hankiewicz2013-03-161-0/+0
* tiny C support; cosmetic improvements for the docsAraq2010-08-281-0/+96
title='Blame the previous revision' href='/ahoang/Nim/blame/tests/stdlib/tunittest.nim?h=devel&id=7e07fc5893baf40093a44c1cee71feea88555f71'>^
7cea0c176 ^

25831a83d ^
5cf789ac3 ^
82bb4db4b ^
f250c30b9 ^

99633d768 ^
3daef85d6 ^
3daef85d6 ^








99633d768 ^
3daef85d6 ^
f250c30b9 ^
3daef85d6 ^

99633d768 ^
c9616897f ^


464ec61e9 ^

eac484167 ^




99633d768 ^

464ec61e9 ^
e7f280bd2 ^
464ec61e9 ^


6d442a40a ^
464ec61e9 ^
7d6cbf290 ^
464ec61e9 ^
c62698b29 ^


















f250c30b9 ^
c62698b29 ^
























fc0bb8280 ^





f250c30b9 ^
310b73b55 ^






5cf789ac3 ^





25831a83d ^
7cea0c176 ^
















b809562c7 ^

































99633d768 ^












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
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
           


                                












                             

                  
                           
   
               

   
                               
 








                                    
                                     
             
                                                                     

 
                  


                               

 




                                  

                                 
                       
                 


                                                            
                           
                       
                                                       
                    


















                                       
                                       
























                                    





                                             
 






                                              





                                     
 
















                                   

































                                                               












                     
discard """
  output: '''

[Suite] suite with only teardown

[Suite] suite with only setup

[Suite] suite with none

[Suite] suite with both

[Suite] bug #4494

[Suite] bug #5571

[Suite] bug #5784

[Suite] test suite

[Suite] test name filtering
'''
targets: "c js"
"""

import std/[unittest, sequtils]

proc doThings(spuds: var int): int =
  spuds = 24
  return 99
test "#964":
  var spuds = 0
  check doThings(spuds) == 99
  check spuds == 24


from std/strutils import toUpperAscii
test "#1384":
  check(@["hello", "world"].map(toUpperAscii) == @["HELLO", "WORLD"])


import std/options
test "unittest typedescs":
  check(none(int) == none(int))
  check(none(int) != some(1))


test "unittest multiple requires":
  require(true)
  require(true)


import std/random
from std/strutils import parseInt
proc defectiveRobot() =
  case rand(1..4)
  of 1: raise newException(OSError, "CANNOT COMPUTE!")
  of 2: discard parseInt("Hello World!")
  of 3: raise newException(IOError, "I can't do that Dave.")
  else: doAssert 2 + 2 == 5
test "unittest expect":
  expect IOError, OSError, ValueError, AssertionDefect:
    defectiveRobot()

var
  a = 1
  b = -1
  c = 1

#unittests are sequential right now
suite "suite with only teardown":
  teardown:
    b = 2

  test "unittest with only teardown 1":
    check a == c

  test "unittest with only teardown 2":
    check b > a

suite "suite with only setup":
  setup:
    var testVar {.used.} = "from setup"

  test "unittest with only setup 1":
    check testVar == "from setup"
    check b > a
    b = -1

  test "unittest with only setup 2":
    check b < a

suite "suite with none":
  test "unittest with none":
    check b < a

suite "suite with both":
  setup:
    a = -2

  teardown:
    c = 2

  test "unittest with both 1":
    check b > a

  test "unittest with both 2":
    check c == 2

suite "bug #4494":
    test "Uniqueness check":
      var tags = @[1, 2, 3, 4, 5]
      check:
        allIt(0..3, tags[it] != tags[it + 1])

suite "bug #5571":
  test "can define gcsafe procs within tests":
    proc doTest {.gcsafe.} =
      let line = "a"
      check: line == "a"
    doTest()

suite "bug #5784":
  test "`or` should short circuit":
    type Obj = ref object
      field: int
    var obj: Obj
    check obj.isNil or obj.field == 0

type
    SomeType = object
        value: int
        children: seq[SomeType]

# bug #5252

proc `==`(a, b: SomeType): bool =
    return a.value == b.value

suite "test suite":
    test "test":
        let a = SomeType(value: 10)
        let b = SomeType(value: 10)

        check(a == b)

suite "test name filtering":
  test "test name":
    check matchFilter("suite1", "foo", "")
    check matchFilter("suite1", "foo", "foo")
    check matchFilter("suite1", "foo", "::")
    check matchFilter("suite1", "foo", "*")
    check matchFilter("suite1", "foo", "::foo")
    check matchFilter("suite1", "::foo", "::foo")

  test "test name - glob":
    check matchFilter("suite1", "foo", "f*")
    check matchFilter("suite1", "foo", "*oo")
    check matchFilter("suite1", "12345", "12*345")
    check matchFilter("suite1", "q*wefoo", "q*wefoo")
    check false == matchFilter("suite1", "foo", "::x")
    check false == matchFilter("suite1", "foo", "::x*")
    check false == matchFilter("suite1", "foo", "::*x")
    #  overlap
    check false == matchFilter("suite1", "12345", "123*345")
    check matchFilter("suite1", "ab*c::d*e::f", "ab*c::d*e::f")

  test "suite name":
    check matchFilter("suite1", "foo", "suite1::")
    check false == matchFilter("suite1", "foo", "suite2::")
    check matchFilter("suite1", "qwe::foo", "qwe::foo")
    check matchFilter("suite1", "qwe::foo", "suite1::qwe::foo")

  test "suite name - glob":
    check matchFilter("suite1", "foo", "::*")
    check matchFilter("suite1", "foo", "*::*")
    check matchFilter("suite1", "foo", "*::foo")
    check false == matchFilter("suite1", "foo", "*ite2::")
    check matchFilter("suite1", "q**we::foo", "q**we::foo")
    check matchFilter("suite1", "a::b*c::d*e", "a::b*c::d*e")


block:
  type MyFoo = object
  var obj = MyFoo()
  let check = 1
  check(obj == obj)

block:
  let check = 123
  var a = 1
  var b = 1
  check(a == b)