From 1f6c442a3f2f660803f598d70f3f69b469637829 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Wed, 8 Aug 2018 23:09:40 +0300 Subject: Fix panic with EOF token --- src/parser_api.rs | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'src/parser_api.rs') diff --git a/src/parser_api.rs b/src/parser_api.rs index 58002a8fc..c78c6e43a 100644 --- a/src/parser_api.rs +++ b/src/parser_api.rs @@ -29,6 +29,15 @@ macro_rules! token_set_union { ($($ts:expr),* ,) => { token_set_union!($($ts),*) }; } +#[test] +fn token_set_works_for_tokens() { + use SyntaxKind::*; + let ts = token_set! { EOF, SHEBANG }; + assert!(ts.contains(EOF)); + assert!(ts.contains(SHEBANG)); + assert!(!ts.contains(PLUS)); +} + /// `Parser` struct provides the low-level API for /// navigating through the stream of tokens and /// constructing the parse tree. The actual parsing -- cgit v1.2.3