Checkpoint
This commit is contained in:
parent
e749f8c6cb
commit
48f94c30df
15 changed files with 175 additions and 67 deletions
|
@ -1,5 +1,6 @@
|
|||
package lexer
|
||||
|
||||
import lexer.errors.LexingError
|
||||
import org.junit.jupiter.api.Test
|
||||
import org.junit.jupiter.api.assertThrows
|
||||
import kotlin.test.assertEquals
|
||||
|
@ -56,6 +57,6 @@ class ScanPrologTests {
|
|||
|
||||
@Test
|
||||
fun scan_variable_that_starts_with_a_number() {
|
||||
assertThrows<Error> { Lexer("1X.").scan() }
|
||||
assertThrows<LexingError> { Lexer("1X.").scan() }
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
package lexer
|
||||
|
||||
import lexer.errors.LexingError
|
||||
import org.junit.jupiter.api.Test
|
||||
import org.junit.jupiter.api.assertThrows
|
||||
import org.junit.jupiter.api.Assertions.*
|
||||
|
@ -14,7 +15,7 @@ class ScanTests {
|
|||
|
||||
@Test
|
||||
fun scan_unknownSymbol_returns_Error() {
|
||||
assertThrows<Error> { Lexer("€").scan() }
|
||||
assertThrows<LexingError> { Lexer("€").scan() }
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -127,12 +128,12 @@ class ScanTests {
|
|||
assertEquals(3, tokens.size)
|
||||
|
||||
assertEquals(
|
||||
TokenType.LEFT_PARENTHESIS,
|
||||
TokenType.PARENTHESIS_LEFT,
|
||||
tokens[0].type,
|
||||
"Expected LEFT_PARENTHESES token, got ${tokens[0].type}"
|
||||
)
|
||||
assertEquals(
|
||||
TokenType.RIGHT_PARENTHESIS,
|
||||
TokenType.PARENTHESIS_RIGHT,
|
||||
tokens[1].type,
|
||||
"Expected RIGHT_PARENTHESES token, got ${tokens[1].type}"
|
||||
)
|
||||
|
|
Reference in a new issue