Fixes #2889. Merges *tostring tests in tests/system.
This commit is contained in:
parent
990812760a
commit
371470e73f
4 changed files with 37 additions and 32 deletions
|
|
@ -2235,7 +2235,9 @@ proc `$`*[T: tuple|object](x: T): string =
|
||||||
firstElement = false
|
firstElement = false
|
||||||
result.add(")")
|
result.add(")")
|
||||||
|
|
||||||
proc collectionToString[T](x: T, b, e: string): string =
|
proc collectionToString[T: set | seq](x: T, b, e: string): string =
|
||||||
|
when x is seq:
|
||||||
|
if x.isNil: return "nil"
|
||||||
result = b
|
result = b
|
||||||
var firstElement = true
|
var firstElement = true
|
||||||
for value in items(x):
|
for value in items(x):
|
||||||
|
|
|
||||||
|
|
@ -1,22 +0,0 @@
|
||||||
discard """
|
|
||||||
output:'''2.3242
|
|
||||||
2.982
|
|
||||||
123912.1
|
|
||||||
123912.1823
|
|
||||||
5.0
|
|
||||||
1e+100
|
|
||||||
inf
|
|
||||||
-inf
|
|
||||||
nan
|
|
||||||
'''
|
|
||||||
"""
|
|
||||||
|
|
||||||
echo($(2.3242))
|
|
||||||
echo($(2.982))
|
|
||||||
echo($(123912.1))
|
|
||||||
echo($(123912.1823))
|
|
||||||
echo($(5.0))
|
|
||||||
echo($(1e100))
|
|
||||||
echo($(1e1000000))
|
|
||||||
echo($(-1e1000000))
|
|
||||||
echo($(0.0/0.0))
|
|
||||||
|
|
@ -1,9 +1,42 @@
|
||||||
discard """
|
discard """
|
||||||
output:'''@[23, 45]
|
output:'''@[23, 45]
|
||||||
@[, foo, bar]'''
|
@[, 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]))
|
echo($(@[23, 45]))
|
||||||
echo($(@["", "foo", "bar"]))
|
echo($(@["", "foo", "bar"]))
|
||||||
#echo($(["", "foo", "bar"]))
|
#echo($(["", "foo", "bar"]))
|
||||||
#echo($([23, 45]))
|
#echo($([23, 45]))
|
||||||
|
|
||||||
|
# bug #2395
|
||||||
|
|
||||||
|
let alphaSet: set[char] = {'a'..'c'}
|
||||||
|
echo alphaSet
|
||||||
|
|
||||||
|
echo($(2.3242))
|
||||||
|
echo($(2.982))
|
||||||
|
echo($(123912.1))
|
||||||
|
echo($(123912.1823))
|
||||||
|
echo($(5.0))
|
||||||
|
echo($(1e100))
|
||||||
|
echo($(1e1000000))
|
||||||
|
echo($(-1e1000000))
|
||||||
|
echo($(0.0/0.0))
|
||||||
|
|
||||||
|
# nil tests
|
||||||
|
var x: seq[string]
|
||||||
|
var y: string
|
||||||
|
echo(x)
|
||||||
|
echo(y)
|
||||||
|
|
|
||||||
|
|
@ -1,8 +0,0 @@
|
||||||
discard """
|
|
||||||
output: "{a, b, c}"
|
|
||||||
"""
|
|
||||||
|
|
||||||
# bug #2395
|
|
||||||
|
|
||||||
let alphaSet: set[char] = {'a'..'c'}
|
|
||||||
echo alphaSet
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue