Skip to content

Commit 88ada3b

Browse files
authored
Streamlines the Scanner Tests. (#25)
Previously, the `Scanner` tests required a lot of manual position expectations which was tedious to write. This replaces that with a test harness that can do the math from chunks of input that the test writer defines as whitespace or token boundaries. This also adds the macro `scanner_test_case!` which makes it so that one can use the harness with a friendly syntax. The old tests are ported to the new macro. Also: * Adds assertions to the internal `LineAndColumn::at`. * Adds convenience constructor around `Content`. Resolves #21.
1 parent 7f2c7fe commit 88ada3b

File tree

2 files changed

+275
-338
lines changed

2 files changed

+275
-338
lines changed

partiql-parser/src/result.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@ impl LineAndColumn {
2424
/// Constructs at [`LineAndColumn`] without verifying 1-position invariant.
2525
#[inline]
2626
pub(crate) fn at(line: usize, column: usize) -> Self {
27+
assert_ne!(0, line);
28+
assert_ne!(0, column);
2729
Self(line, column)
2830
}
2931

0 commit comments

Comments
 (0)