diff options
author | Araq <rumpf_a@web.de> | 2016-03-29 15:30:44 +0200 |
---|---|---|
committer | Araq <rumpf_a@web.de> | 2016-03-29 15:31:10 +0200 |
commit | db2b2156581ffaaa63e7ff9c0a07ced540006956 (patch) | |
tree | 341535aa355ef422ee886f7b14fda6fbfeae0523 /tests | |
parent | 8bf14b12a963980e71ad46e16a8a2e35c9465b8c (diff) | |
parent | b4f1eef3a3b0ff56d0a68c15c43ffecb7778e939 (diff) | |
download | Nim-db2b2156581ffaaa63e7ff9c0a07ced540006956.tar.gz |
resolved merge conflicts
Diffstat (limited to 'tests')
-rw-r--r-- | tests/async/tasyncawait.nim | 2 | ||||
-rw-r--r-- | tests/ccgbugs/tstringslice.nim | 3 | ||||
-rw-r--r-- | tests/generics/tcritical.nim | 19 | ||||
-rw-r--r-- | tests/manyloc/keineschweine/lib/sg_assets.nim | 1 | ||||
-rw-r--r-- | tests/misc/parsecomb.nim | 26 | ||||
-rw-r--r-- | tests/seq/tshallowseq.nim | 17 |
6 files changed, 51 insertions, 17 deletions
diff --git a/tests/async/tasyncawait.nim b/tests/async/tasyncawait.nim index 443f769cd..9fe9507ad 100644 --- a/tests/async/tasyncawait.nim +++ b/tests/async/tasyncawait.nim @@ -45,7 +45,7 @@ proc createServer(port: TPort) {.async.} = name.sin_family = toInt(AF_INET).int16 else: name.sin_family = toInt(AF_INET) - name.sin_port = htons(int16(port)) + name.sin_port = htons(uint16(port)) name.sin_addr.s_addr = htonl(INADDR_ANY) if bindAddr(server.SocketHandle, cast[ptr SockAddr](addr(name)), sizeof(name).Socklen) < 0'i32: diff --git a/tests/ccgbugs/tstringslice.nim b/tests/ccgbugs/tstringslice.nim index 00c1adf74..f6f64bebc 100644 --- a/tests/ccgbugs/tstringslice.nim +++ b/tests/ccgbugs/tstringslice.nim @@ -9,7 +9,6 @@ discard """ 34 34 4 -4 4''' """ @@ -21,4 +20,4 @@ const str = "123456789" for i in TRange.low .. TRange.high: echo str[i] #This works fine echo str[int(i) .. int(TRange.high)] #So does this - echo str[i .. TRange.high] #The compiler complains about this + #echo str[i .. TRange.high] #The compiler complains about this diff --git a/tests/generics/tcritical.nim b/tests/generics/tcritical.nim new file mode 100644 index 000000000..e84c03618 --- /dev/null +++ b/tests/generics/tcritical.nim @@ -0,0 +1,19 @@ +discard """ + errormsg: "type mismatch" + line: 18 +""" + +# bug #3998 + +type Vec3[T] = array[3, T] + +var vg: Vec3[float32] = Vec3([1.0f, 2.0f, 3.0f]) + +echo "vg[0]: " & $vg[0] # prints 1.0 OK +echo "vg[1]: " & $vg[1] # prints 2.0 OK +echo "vg[2]: " & $vg[2] # prints 3.0 OK +echo "" + +var ve: Vec3[float64] +ve = vg # compiles, this MUST NOT be allowed! + diff --git a/tests/manyloc/keineschweine/lib/sg_assets.nim b/tests/manyloc/keineschweine/lib/sg_assets.nim index 801c3456b..fbc3c9ab8 100644 --- a/tests/manyloc/keineschweine/lib/sg_assets.nim +++ b/tests/manyloc/keineschweine/lib/sg_assets.nim @@ -110,7 +110,6 @@ type TGameState* = enum Lobby, Transitioning, Field const - TAU* = PI * 2.0 MomentMult* = 0.62 ## global moment of inertia multiplier var cfg: PZoneSettings diff --git a/tests/misc/parsecomb.nim b/tests/misc/parsecomb.nim index 68a61373f..05fe97ad1 100644 --- a/tests/misc/parsecomb.nim +++ b/tests/misc/parsecomb.nim @@ -13,15 +13,15 @@ type nil type - Parser*[T, O] = distinct proc (input: Input[T]): Result[T, O] + Parser*[T, O] = proc (input: Input[T]): Result[T, O] proc unit*[T, O](v: O): Parser[T, O] = - Parser(proc (inp: Input[T]): Result[T, O] = - Result[T, O](kind: rkSuccess, output: v, input: inp)) + result = proc (inp: Input[T]): Result[T, O] = + Result[T, O](kind: rkSuccess, output: v, input: inp) proc fail*[T, O](): Parser[T, O] = - Parser(proc (inp: Input[T]): Result[T, O] = - Result(kind: rkFailure)) + result = proc (inp: Input[T]): Result[T, O] = + Result(kind: rkFailure) method runInput[T, O](self: Parser[T, O], inp: Input[T]): Result[T, O] = # hmmm .. @@ -33,39 +33,39 @@ method run*[T, O](self: Parser[T, O], toks: seq[T]): Result[T, O] = self.runInput(Input[T](toks: toks, index: 0)) method chain*[T, O1, O2](self: Parser[T, O1], nextp: proc (v: O1): Parser[T, O2]): Parser[T, O2] = - Parser(proc (inp: Input[T]): Result[T, O2] = + result = proc (inp: Input[T]): Result[T, O2] = let r = self.runInput(inp) case r.kind: of rkSuccess: nextp(r.output).runInput(r.input) of rkFailure: - Result[T, O2](kind: rkFailure)) + Result[T, O2](kind: rkFailure) method skip[T](self: Input[T], n: int): Input[T] = Input[T](toks: self.toks, index: self.index + n) proc pskip*[T](n: int): Parser[T, tuple[]] = - Parser(proc (inp: Input[T]): Result[T, tuple[]] = + result = proc (inp: Input[T]): Result[T, tuple[]] = if inp.index + n <= inp.toks.len: Result[T, tuple[]](kind: rkSuccess, output: (), input: inp.skip(n)) else: - Result[T, tuple[]](kind: rkFailure)) + Result[T, tuple[]](kind: rkFailure) proc tok*[T](t: T): Parser[T, T] = - Parser(proc (inp: Input[T]): Result[T, T] = + result = proc (inp: Input[T]): Result[T, T] = if inp.index < inp.toks.len and inp.toks[inp.index] == t: pskip[T](1).then(unit[T, T](t)).runInput(inp) else: - Result[T, T](kind: rkFailure)) + Result[T, T](kind: rkFailure) proc `+`*[T, O](first: Parser[T, O], second: Parser[T, O]): Parser[T, O] = - Parser(proc (inp: Input[T]): Result[T, O] = + result = proc (inp: Input[T]): Result[T, O] = let r = first.runInput(inp) case r.kind of rkSuccess: r else: - second.runInput(inp)) + second.runInput(inp) # end of primitives (definitions involving Parser(..)) diff --git a/tests/seq/tshallowseq.nim b/tests/seq/tshallowseq.nim new file mode 100644 index 000000000..9a8bdb954 --- /dev/null +++ b/tests/seq/tshallowseq.nim @@ -0,0 +1,17 @@ +discard """ + output: '''@[1, 42, 3] +@[1, 42, 3] +''' +""" +proc xxx() = + var x: seq[int] = @[1, 2, 3] + var y: seq[int] + + system.shallowCopy(y, x) + + y[1] = 42 + + echo y + echo x + +xxx() |