Add tokenization test

This commit is contained in:
greg 2015-12-20 17:03:03 -08:00
parent 16dfbb27d5
commit 841b38d5b1

View File

@ -115,3 +115,15 @@ fn handle_identifier(identifier: String) -> Token {
return Token::Keyword(keyword);
}
#[cfg(test)]
mod tests {
use super::*;
#[test]
fn tokeniziation_tests() {
let t1 = "let a = 3\n";
assert_eq!(format!("{:?}", tokenize(t1)),
"[Keyword(Let), Identifier(\"a\"), Keyword(Assign), NumLiteral(3), Separator, EOF]");
}
}