summary refs log tree commit diff stats
path: root/tests/system
diff options
context:
space:
mode:
Diffstat (limited to 'tests/system')
-rw-r--r--tests/system/tdollars.nim8
-rw-r--r--tests/system/tensuremove.nim5
-rw-r--r--tests/system/tensuremove2.nim2
-rw-r--r--tests/system/tnewstring_uninitialized.nim11
-rw-r--r--tests/system/tsystem_misc.nim13
5 files changed, 32 insertions, 7 deletions
diff --git a/tests/system/tdollars.nim b/tests/system/tdollars.nim
index 39337cca7..eabee81b3 100644
--- a/tests/system/tdollars.nim
+++ b/tests/system/tdollars.nim
@@ -1,5 +1,5 @@
 discard """
-  matrix: "--mm:refc; --mm:orc; --backend:cpp; --backend:js --jsbigint64:off; --backend:js --jsbigint64:on"
+  matrix: "--mm:refc; --mm:orc; --backend:cpp; --backend:js --jsbigint64:off -d:nimStringHash2; --backend:js --jsbigint64:on"
 """
 
 #[
@@ -109,10 +109,10 @@ block:
     # if `uint8(a1)` changes meaning to `cast[uint8](a1)` in future, update this test;
     # until then, this is the correct semantics.
     let a3 = $a2
-    doAssert a2 < 3
-    doAssert a3 == "-1"
+    doAssert a2 == 255'u8
+    doAssert a3 == "255"
     proc intToStr(a: uint8): cstring {.importjs: "(# + \"\")".}
-    doAssert $intToStr(a2) == "-1"
+    doAssert $intToStr(a2) == "255"
   else:
     block:
       let x = -1'i8
diff --git a/tests/system/tensuremove.nim b/tests/system/tensuremove.nim
index 980f2ea58..668d5aed1 100644
--- a/tests/system/tensuremove.nim
+++ b/tests/system/tensuremove.nim
@@ -1,5 +1,5 @@
 discard """
-  target: "c js"
+  targets: "c js"
   matrix: "--cursorinference:on; --cursorinference:off"
 """
 
@@ -20,7 +20,8 @@ block:
     discard x.s
 
   proc main =
-    var x = X(s: "abcdefg")
+    let m = "abcdefg"
+    var x = X(s: ensureMove m)
     consume(ensureMove x)
 
   static: main()
diff --git a/tests/system/tensuremove2.nim b/tests/system/tensuremove2.nim
index 1fcbc1c0f..39bbeb22e 100644
--- a/tests/system/tensuremove2.nim
+++ b/tests/system/tensuremove2.nim
@@ -1,5 +1,5 @@
 discard """
-  errormsg: "'if true: s else: String()' is not a mutable location; it cannot be moved"
+  errormsg: "Nested expressions cannot be moved: 'if true: s else: String()'"
 """
 
 type
diff --git a/tests/system/tnewstring_uninitialized.nim b/tests/system/tnewstring_uninitialized.nim
new file mode 100644
index 000000000..9bc0e1622
--- /dev/null
+++ b/tests/system/tnewstring_uninitialized.nim
@@ -0,0 +1,11 @@
+discard """
+  matrix: "--mm:refc;"
+"""
+
+# bug #22555
+var x = newStringUninit(10)
+doAssert x.len == 10
+for i in 0..<x.len:
+  x[i] = chr(ord('a') + i)
+
+doAssert x == "abcdefghij"
diff --git a/tests/system/tsystem_misc.nim b/tests/system/tsystem_misc.nim
index 7f5914725..1debb7c48 100644
--- a/tests/system/tsystem_misc.nim
+++ b/tests/system/tsystem_misc.nim
@@ -212,3 +212,16 @@ block:
   doAssert not compiles(echo p.rawProc.repr)
   doAssert not compiles(echo p.rawEnv.repr)
   doAssert not compiles(echo p.finished)
+
+proc bug23223 = # bug #23223
+  var stuff = "hello"
+  stuff.insert ""
+  doAssert stuff == "hello"
+
+bug23223()
+
+block: # bug #23894
+  let v = high(uint) div 2
+  let s = v + 1 # 9223372036854775808
+  let m = succ v
+  doAssert s == m