Skip to content

Commit

Permalink
Add parity test for scanner
Browse files Browse the repository at this point in the history
  • Loading branch information
kubukoz committed Oct 3, 2023
1 parent 9526d1a commit b35bbf7
Showing 1 changed file with 13 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ import io.circe.Decoder
import io.circe.syntax._
import playground.Assertions._
import playground.smithyql._
import playground.smithyql.parser.v2.scanner.Scanner
import playground.smithyql.parser.v2.scanner.TokenKind
import weaver._

import java.nio.file
Expand Down Expand Up @@ -52,6 +54,17 @@ trait ParserSuite extends SimpleIOSuite {
}
}
}

test(testCase.name + " (v2 scanner)") {
testCase.readInput(trimWhitespace).map { input =>
val scanned = Scanner.scan(input)

val errors = scanned.filter(_.kind == TokenKind.Error)
// non-empty inputs should parse to non-empty outputs
assert(input.isEmpty || scanned.nonEmpty) &&
assert(errors.isEmpty)
}
}
}

def loadNegativeParserTests[Alg[_[_]]: SourceParser](
Expand Down

0 comments on commit b35bbf7

Please sign in to comment.