Add tests for comment removal
This commit is contained in:
parent
2a05453f8e
commit
47bf17cb0b
15
src/tests.rs
15
src/tests.rs
|
@ -1,5 +1,5 @@
|
|||
#[cfg(test)]
|
||||
use crate::tcl::{commands, words};
|
||||
use crate::tcl::{commands, comments, words};
|
||||
|
||||
#[test]
|
||||
fn test_commands_working() {
|
||||
|
@ -66,3 +66,16 @@ fn test_words_quoted() {
|
|||
let case: Vec<String> = words(testcase);
|
||||
assert_eq!(case, verify);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_remove_comments() {
|
||||
let testcase_1: &str = "test#noreplacement";
|
||||
let testcase_2: &str = ";#replace_this\n";
|
||||
let verify_1: &str = "test#noreplacement";
|
||||
let verify_2: &str = ";";
|
||||
let case_1: &str = comments(testcase_1).as_str();
|
||||
let case_2: &str = comments(testcase_2).as_str();
|
||||
|
||||
assert_eq!(verify_1, case_1);
|
||||
assert_eq!(verify_2, case_2);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue