mirror of
https://github.com/nushell/nushell.git
synced 2025-08-19 23:58:36 +02:00
tests for lex and lite parser
This commit is contained in:
@@ -307,41 +307,4 @@ pub fn lex(
|
||||
}
|
||||
}
|
||||
(output, error)
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod lex_tests {
|
||||
use super::*;
|
||||
|
||||
#[test]
|
||||
fn lex_basic() {
|
||||
let file = b"let x = 4";
|
||||
|
||||
let output = lex(file, 0, &[], &[]);
|
||||
|
||||
assert!(output.1.is_none());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn lex_newline() {
|
||||
let file = b"let x = 300\nlet y = 500;";
|
||||
|
||||
let output = lex(file, 0, &[], &[]);
|
||||
|
||||
println!("{:#?}", output.0);
|
||||
assert!(output.0.contains(&Token {
|
||||
contents: TokenContents::Eol,
|
||||
span: Span { start: 11, end: 12 }
|
||||
}));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn lex_empty() {
|
||||
let file = b"";
|
||||
|
||||
let output = lex(file, 0, &[], &[]);
|
||||
|
||||
assert!(output.0.is_empty());
|
||||
assert!(output.1.is_none());
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user