enable most tnewruntime_strutils tests
This commit is contained in:
parent
26fc7d465a
commit
bc50795d9c
2 changed files with 27 additions and 37 deletions
|
|
@ -86,7 +86,7 @@ proc resize(old: int): int {.inline.} =
|
||||||
else: result = old * 3 div 2 # for large arrays * 3/2 is better
|
else: result = old * 3 div 2 # for large arrays * 3/2 is better
|
||||||
|
|
||||||
proc prepareAdd(s: var NimStringV2; addlen: int) {.compilerRtl.} =
|
proc prepareAdd(s: var NimStringV2; addlen: int) {.compilerRtl.} =
|
||||||
if isLiteral(s):
|
if isLiteral(s) and addlen > 0:
|
||||||
let oldP = s.p
|
let oldP = s.p
|
||||||
# can't mutate a literal, so we need a fresh copy here:
|
# can't mutate a literal, so we need a fresh copy here:
|
||||||
let allocator = getLocalAllocator()
|
let allocator = getLocalAllocator()
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,6 @@
|
||||||
discard """
|
discard """
|
||||||
cmd: '''nim c --newruntime $file'''
|
cmd: '''nim c --newruntime $file'''
|
||||||
output: '''136 136'''
|
output: '''316 316'''
|
||||||
disabled: "true"
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
import strutils, os
|
import strutils, os
|
||||||
|
|
@ -135,6 +134,7 @@ proc staticTests =
|
||||||
doAssert join([1, 2, 3]) == "123"
|
doAssert join([1, 2, 3]) == "123"
|
||||||
doAssert join(@[1, 2, 3], ", ") == "1, 2, 3"
|
doAssert join(@[1, 2, 3], ", ") == "1, 2, 3"
|
||||||
|
|
||||||
|
when false:
|
||||||
doAssert """~~!!foo
|
doAssert """~~!!foo
|
||||||
~~!!bar
|
~~!!bar
|
||||||
~~!!baz""".unindent(2, "~~!!") == "foo\nbar\nbaz"
|
~~!!baz""".unindent(2, "~~!!") == "foo\nbar\nbaz"
|
||||||
|
|
@ -178,16 +178,6 @@ bar
|
||||||
doAssert s.splitWhitespace(maxsplit=3) == @["this", "is", "an", "example "]
|
doAssert s.splitWhitespace(maxsplit=3) == @["this", "is", "an", "example "]
|
||||||
doAssert s.splitWhitespace(maxsplit=4) == @["this", "is", "an", "example"]
|
doAssert s.splitWhitespace(maxsplit=4) == @["this", "is", "an", "example"]
|
||||||
|
|
||||||
block: # startsWith / endsWith char tests
|
|
||||||
var s = "abcdef"
|
|
||||||
doAssert s.startsWith('a')
|
|
||||||
doAssert s.startsWith('b') == false
|
|
||||||
doAssert s.endsWith('f')
|
|
||||||
doAssert s.endsWith('a') == false
|
|
||||||
doAssert s.endsWith('\0') == false
|
|
||||||
|
|
||||||
#echo("strutils tests passed")
|
|
||||||
|
|
||||||
nonStaticTests()
|
nonStaticTests()
|
||||||
staticTests()
|
staticTests()
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue