You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
use ilex::{rule::Digital,Lexeme};#[ilex::spec]structNoPrefix{#[named]#[rule(Digital::new(10))]number:Lexeme<Digital>,}#[ilex::spec]structHasPrefix{#[named]#[rule(Digital::new(10).prefix("$"))]number:Lexeme<Digital>,}macro_rules! test {($testname:ident, $spec:expr, $input:literal, $check:expr) => {
#[test]fn $testname(){let ctx = ilex::Context::new();
let report = ctx.new_report();
let result = ctx.new_file("filename", $input).lex($spec, &report);
assert!($check(&result));
}};}test!(noprefix_validinput, NoPrefix::get().spec(), "123", Result::is_ok);test!(hasprefix_validinput, HasPrefix::get().spec(), "$123", Result::is_ok);test!(noprefix_badinput_abc, NoPrefix::get().spec(), "abc", Result::is_err);test!(hasprefix_badinput_abc, HasPrefix::get().spec(), "abc", Result::is_err);test!(hasprefix_badinput_prefixabc, HasPrefix::get().spec(), "$abc", Result::is_err);test!(noprefix_badinput_other, NoPrefix::get().spec(), "#", Result::is_err);test!(hasprefix_badinput_other, HasPrefix::get().spec(), "#", Result::is_err);
running 7 tests
test noprefix_validinput ... ok
test hasprefix_validinput ... ok
test noprefix_badinput_abc ... ok
test hasprefix_badinput_abc ... ok
test hasprefix_badinput_prefixabc ... ok
test noprefix_badinput_other ... FAILED
test hasprefix_badinput_other ... ok
failures:
---- noprefix_badinput_other stdout ----
thread 'noprefix_badinput_other' panicked at C:\Users\amgg\.cargo\registry\src\index.crates.io-6f17d22bba15001f\ilex-0.5.0\src\rt\emit2.rs:540:41:
called `Option::unwrap()` on a `None` value
The text was updated successfully, but these errors were encountered:
ilex
version:0.5.0
Digital
rules that don't have prefixes panic on some invalid inputs, from theunwrap
herestrings/ilex/src/rt/emit2.rs
Line 540 in 42960bd
example:
The text was updated successfully, but these errors were encountered: