string object identity hashcode can be negative sometimes, so allow a '-' character.

This commit is contained in:
Irmen de Jong 2021-10-19 21:08:15 +02:00
parent 502bf90007
commit e5b9e1f5e7
2 changed files with 4 additions and 4 deletions

View File

@ -219,7 +219,7 @@ class TestProg8Parser {
val module = parseModule(SourceCode.Text(srcText)) val module = parseModule(SourceCode.Text(srcText))
// Note: assertContains has *actual* as first param // Note: assertContains has *actual* as first param
assertContains(module.name, Regex("^<String@[0-9a-f]+>$")) assertContains(module.name, Regex("^<String@[0-9a-f\\-]+>$"))
} }
@Test @Test
@ -289,7 +289,7 @@ class TestProg8Parser {
try { try {
parseModule(SourceCode.Text(srcText)) parseModule(SourceCode.Text(srcText))
} catch (e: ParseError) { } catch (e: ParseError) {
assertPosition(e.position, Regex("^<String@[0-9a-f]+>$"), 1, 4, 4) assertPosition(e.position, Regex("^<String@[0-9a-f\\-]+>$"), 1, 4, 4)
} }
} }
@ -312,7 +312,7 @@ class TestProg8Parser {
} }
""".trimIndent() """.trimIndent()
val module = parseModule(SourceCode.Text(srcText)) val module = parseModule(SourceCode.Text(srcText))
assertPositionOf(module, Regex("^<String@[0-9a-f]+>$"), 1, 0) // TODO: endCol wrong assertPositionOf(module, Regex("^<String@[0-9a-f\\-]+>$"), 1, 0) // TODO: endCol wrong
} }
@Test @Test

View File

@ -22,7 +22,7 @@ class TestSourceCode {
val src = SourceCode.Text(text) val src = SourceCode.Text(text)
val actualText = src.getCharStream().toString() val actualText = src.getCharStream().toString()
assertContains(src.origin, Regex("^<String@[0-9a-f]+>$")) assertContains(src.origin, Regex("^<String@[0-9a-f\\-]+>$"))
assertEquals(text, actualText) assertEquals(text, actualText)
assertFalse(src.isFromResources) assertFalse(src.isFromResources)
assertFalse(src.isFromFilesystem) assertFalse(src.isFromFilesystem)