made toString test assert based
This commit is contained in:
parent
c9a2acefc1
commit
a6e6b05565
1 changed files with 21 additions and 33 deletions
|
|
@ -1,44 +1,32 @@
|
||||||
discard """
|
discard """
|
||||||
output:'''@[23, 45]
|
output:""
|
||||||
@[, foo, bar]
|
|
||||||
{a, b, c}
|
|
||||||
2.3242
|
|
||||||
2.982
|
|
||||||
123912.1
|
|
||||||
123912.1823
|
|
||||||
5.0
|
|
||||||
1e+100
|
|
||||||
inf
|
|
||||||
-inf
|
|
||||||
nan
|
|
||||||
nil
|
|
||||||
nil
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
echo($(@[23, 45]))
|
doAssert "@[23, 45]" == $(@[23, 45])
|
||||||
echo($(@["", "foo", "bar"]))
|
doAssert "[32, 45]" == $([32, 45])
|
||||||
#echo($(["", "foo", "bar"]))
|
doAssert "@[, foo, bar]" == $(@["", "foo", "bar"])
|
||||||
#echo($([23, 45]))
|
doAssert "[, foo, bar]" == $(["", "foo", "bar"])
|
||||||
|
|
||||||
# bug #2395
|
# bug #2395
|
||||||
|
|
||||||
let alphaSet: set[char] = {'a'..'c'}
|
let alphaSet: set[char] = {'a'..'c'}
|
||||||
echo alphaSet
|
doAssert "{a, b, c}" == $alphaSet
|
||||||
|
doAssert "2.3242" == $(2.3242)
|
||||||
echo($(2.3242))
|
doAssert "2.982" == $(2.982)
|
||||||
echo($(2.982))
|
doAssert "123912.1" == $(123912.1)
|
||||||
echo($(123912.1))
|
doAssert "123912.1823" == $(123912.1823)
|
||||||
echo($(123912.1823))
|
doAssert "5.0" == $(5.0)
|
||||||
echo($(5.0))
|
doAssert "1e+100" == $(1e100)
|
||||||
echo($(1e100))
|
doAssert "inf" == $(1e1000000)
|
||||||
echo($(1e1000000))
|
doAssert "-inf" == $(-1e1000000)
|
||||||
echo($(-1e1000000))
|
doAssert "nan" == $(0.0/0.0)
|
||||||
echo($(0.0/0.0))
|
|
||||||
|
|
||||||
# nil tests
|
# nil tests
|
||||||
|
# maybe a bit inconsistent in types
|
||||||
var x: seq[string]
|
var x: seq[string]
|
||||||
var y: string
|
doAssert "nil" == $(x)
|
||||||
echo(x)
|
|
||||||
echo(y)
|
var y: string = nil
|
||||||
|
doAssert nil == $(y)
|
||||||
|
|
||||||
type
|
type
|
||||||
Foo = object
|
Foo = object
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue