Merge remote-tracking branch 'nim-lang/devel' into emscripten-support

This commit is contained in:
Andrey Sobolev 2015-10-01 22:08:29 +06:00
commit 4c53a3a7a5
35 changed files with 156 additions and 83 deletions

View file

@ -4,4 +4,7 @@ discard """
msg: '''[NimScript] exec: gcc -v'''
"""
when not defined(definedefine):
{.fatal: "wrong nim script configuration".}
echo "hello world!"

View file

@ -10,5 +10,6 @@ task listDirs, "lists every subdirectory":
echo "DIR ", x
task default, "default target":
--define: definedefine
setCommand "c"

View file

@ -0,0 +1,22 @@
discard """
ccodeCheck: "\\i @'unsigned int flag:1;' .*"
"""
type
bits* = object
flag* {.bitsize: 1.}: cuint
opts* {.bitsize: 4.}: cint
var
b: bits
assert b.flag == 0
b.flag = 1
assert b.flag == 1
b.flag = 2
assert b.flag == 0
b.opts = 7
assert b.opts == 7
b.opts = 9
assert b.opts == -7

View file

@ -0,0 +1,9 @@
discard """
file: "trat_float.nim"
line: "9,19"
errormsg: '''type mismatch: got'''
"""
import rationals
var
# this fails - no floats as num or den
r = initRational(1.0'f, 1.0'f)

View file

@ -0,0 +1,10 @@
discard """
file: "trat_init.nim"
exitcode: "1"
"""
import rationals
var
z = Rational[int](num: 0, den: 1)
o = initRational(num=1, den=1)
a = initRational(1, 2)
r = initRational(1, 0) # this fails - no zero denominator

View file

@ -1,8 +1,10 @@
discard """
file: "tmemfiles2.nim"
disabled: true
output: '''Full read size: 20
Half read size: 10 Data: Hello'''
"""
# doesn't work on windows. fmReadWrite doesn't create a file.
import memfiles, os
var
mm, mm_full, mm_half: MemFile

View file

@ -1,4 +1,4 @@
#! stdtmpl
#? stdtmpl
#proc sunsetTemplate*(current, ticker, content: string,
# tabs: openarray[array[0..1, string]]): string =
# result = ""

View file

@ -340,7 +340,7 @@ proc `&?.`(a, b: string): string =
# candidate for the stdlib?
result = if a.endswith(b): a else: a & b
proc processCategory(r: var TResults, cat: Category, options: string) =
proc processCategory(r: var TResults, cat: Category, options: string, fileGlob: string = "t*.nim") =
case cat.string.normalize
of "rodfiles":
discard # Disabled for now
@ -377,5 +377,5 @@ proc processCategory(r: var TResults, cat: Category, options: string) =
of "nimble-all":
testNimblePackages(r, cat, pfAll)
else:
for name in os.walkFiles("tests" & DirSep &.? cat.string / "t*.nim"):
for name in os.walkFiles("tests" & DirSep &.? cat.string / fileGlob):
testSpec r, makeTest(name, options, cat)

View file

@ -23,6 +23,7 @@ const
Command:
all run all tests
c|category <category> run all the tests of a certain category
r|run <test> run single test file
html [commit] generate $1 from the database; uses the latest
commit or a specific one (use -1 for the commit
before latest etc)
@ -376,6 +377,11 @@ proc main() =
var cat = Category(p.key)
p.next
processCategory(r, cat, p.cmdLineRest.string)
of "r", "run":
let (dir, file) = splitPath(p.key.string)
let (_, subdir) = splitPath(dir)
var cat = Category(subdir)
processCategory(r, cat, p.cmdLineRest.string, file)
of "html":
var commit = 0
discard parseInt(p.cmdLineRest.string, commit)

View file

@ -0,0 +1,16 @@
discard """
msg: "abc xyz bb"
"""
# bug #2473
type
Test = tuple[a,b: string]
static:
var s:seq[Test] = @[(a:"a", b:"b")]
s[0] = (a:"aa", b:"bb")
var x: Test
x.a = "abc"
x.b = "xyz"
echo x.a, " ", x.b, " ", s[0].b

View file

@ -1,6 +1,6 @@
discard """
errormsg: "cannot evaluate at compile time: x"
line: 9
line: 7
"""
var x: array[100, char]