diff options
author | Andreas Rumpf <rumpf_a@web.de> | 2019-03-04 22:44:23 +0100 |
---|---|---|
committer | Andreas Rumpf <rumpf_a@web.de> | 2019-03-04 22:44:23 +0100 |
commit | f90735412169f92196a0f425e02dba5e190ac8a3 (patch) | |
tree | c5cdd06440bb0608d653b746d4ae4a2056051fa9 /tests/destructor | |
parent | 3e922d0fec0dbb28ef1182cf27d114759e0f47b6 (diff) | |
download | Nim-f90735412169f92196a0f425e02dba5e190ac8a3.tar.gz |
make tests green again
Diffstat (limited to 'tests/destructor')
-rw-r--r-- | tests/destructor/tatomicptrs.nim | 3 | ||||
-rw-r--r-- | tests/destructor/tcast.nim | 4 | ||||
-rw-r--r-- | tests/destructor/tcustomseqs.nim | 1 | ||||
-rw-r--r-- | tests/destructor/tcustomstrings.nim | 1 | ||||
-rw-r--r-- | tests/destructor/tdestructor3.nim | 1 | ||||
-rw-r--r-- | tests/destructor/tmove_objconstr.nim | 27 | ||||
-rw-r--r-- | tests/destructor/topttree.nim | 1 |
7 files changed, 14 insertions, 24 deletions
diff --git a/tests/destructor/tatomicptrs.nim b/tests/destructor/tatomicptrs.nim index fd8fc34d9..96d145076 100644 --- a/tests/destructor/tatomicptrs.nim +++ b/tests/destructor/tatomicptrs.nim @@ -11,7 +11,6 @@ deallocating allocating deallocating ''' - cmd: '''nim c --newruntime $file''' """ type @@ -125,7 +124,7 @@ proc `=`*[T](m: var MySeq[T], m2: MySeq[T]) = `=destroy`(m) m.len = m2.len - let bytes = m.len.int * sizeof(float) + let bytes = m.len.int * sizeof(float) if bytes > 0: m.data = cast[ptr UncheckedArray[T]](allocShared(bytes)) copyMem(m.data, m2.data, bytes) diff --git a/tests/destructor/tcast.nim b/tests/destructor/tcast.nim index 7d5a1954c..35a7d874b 100644 --- a/tests/destructor/tcast.nim +++ b/tests/destructor/tcast.nim @@ -1,7 +1,3 @@ -discard """ - cmd: '''nim c --newruntime $file''' -""" - # Make sure we don't walk cast[T] type section while injecting sinks/destructors block: type diff --git a/tests/destructor/tcustomseqs.nim b/tests/destructor/tcustomseqs.nim index 83df0053f..c8531a79e 100644 --- a/tests/destructor/tcustomseqs.nim +++ b/tests/destructor/tcustomseqs.nim @@ -16,7 +16,6 @@ discard """ 1 2 6 1 3 7 after 6 6''' - cmd: '''nim c --newruntime $file''' """ import typetraits diff --git a/tests/destructor/tcustomstrings.nim b/tests/destructor/tcustomstrings.nim index 1a78df20b..343d23065 100644 --- a/tests/destructor/tcustomstrings.nim +++ b/tests/destructor/tcustomstrings.nim @@ -5,7 +5,6 @@ foo bar to appendmore here foo bar to appendmore here foo bar to appendmore here after 20 20''' - cmd: '''nim c --newruntime $file''' """ {.this: self.} diff --git a/tests/destructor/tdestructor3.nim b/tests/destructor/tdestructor3.nim index 5756e9afb..2f3b9f6fd 100644 --- a/tests/destructor/tdestructor3.nim +++ b/tests/destructor/tdestructor3.nim @@ -6,7 +6,6 @@ destroy 123 destroy Foo: 5 destroy Foo: 123''' - cmd: '''nim c --newruntime $file''' """ # bug #2821 diff --git a/tests/destructor/tmove_objconstr.nim b/tests/destructor/tmove_objconstr.nim index 7e2b765fc..137913777 100644 --- a/tests/destructor/tmove_objconstr.nim +++ b/tests/destructor/tmove_objconstr.nim @@ -7,7 +7,6 @@ test destroyed 0 3 4 Pony is dying!''' - cmd: '''nim c --newruntime $file''' """ # bug #4214 @@ -68,7 +67,7 @@ for x in getPony(): type MySeqNonCopyable* = object - len: int + len: int data: ptr UncheckedArray[float] proc `=destroy`*(m: var MySeqNonCopyable) {.inline.} = @@ -93,7 +92,7 @@ proc `[]`*(m: MySeqNonCopyable; i: int): float {.inline.} = proc `[]=`*(m: var MySeqNonCopyable; i, val: float) {.inline.} = m.data[i.int] = val -proc setTo(s: var MySeqNonCopyable, val: float) = +proc setTo(s: var MySeqNonCopyable, val: float) = for i in 0..<s.len.int: s.data[i] = val @@ -110,18 +109,18 @@ proc myfunc(x, y: int): (MySeqNonCopyable, MySeqNonCopyable) = proc myfunc2(x, y: int): tuple[a: MySeqNonCopyable, b:int, c:MySeqNonCopyable] = var cc = newMySeq(y, 5.0) (a: case x: - of 1: + of 1: let (z1, z2) = myfunc(x,y) z2 elif x > 5: raise newException(ValueError, "new error") - else: newMySeq(x, 1.0), - b: 0, + else: newMySeq(x, 1.0), + b: 0, c: block: var tmp = if y > 0: move(cc) else: newMySeq(1, 3.0) tmp[0] = 5 - tmp + tmp ) - + let (seq1, seq2) = myfunc(2, 3) doAssert seq1.len == 2 @@ -141,20 +140,20 @@ seq4 = block: tmp[0] = 3.0 tmp -doAssert seq4[0] == 3.0 +doAssert seq4[0] == 3.0 import macros -seq4 = - if i > 0: newMySeq(2, 5.0) +seq4 = + if i > 0: newMySeq(2, 5.0) elif i < -100: raise newException(ValueError, "Parse Error") else: newMySeq(2, 3.0) -seq4 = +seq4 = case (char) i: - of 'A', {'W'..'Z'}: newMySeq(2, 5.0) + of 'A', {'W'..'Z'}: newMySeq(2, 5.0) of 'B': quit(-1) - else: + else: let (x1, x2, x3) = myfunc2(2, 3) x3 diff --git a/tests/destructor/topttree.nim b/tests/destructor/topttree.nim index 21b283be0..43ad4569b 100644 --- a/tests/destructor/topttree.nim +++ b/tests/destructor/topttree.nim @@ -8,7 +8,6 @@ discard """ 90.0 120.0 8 8''' - cmd: '''nim c --newruntime $file''' """ import typetraits |