| 123 | |
| 124 | impl CSSTokenizerTestCase { |
| 125 | fn new(source_path: PathBuf) -> Self { |
| 126 | let json_path = source_path.as_path().parent().unwrap().join("tokens.json").to_path_buf(); |
| 127 | let path = source_path.parent().unwrap(); |
| 128 | let name = format!( |
| 129 | "{}-{}", |
| 130 | &path.parent().unwrap().file_name().unwrap().to_str().unwrap(), |
| 131 | &path.file_name().unwrap().to_str().unwrap() |
| 132 | ); |
| 133 | let source_text = read_to_string(&source_path).unwrap(); |
| 134 | let desired: Vec<CSSTokenizerTestToken> = from_str(read_to_string(json_path.clone()).unwrap().as_str()) |
| 135 | .unwrap_or_else(|e| panic!("{} {}", json_path.display(), e)); |
| 136 | Self { name, source_text, desired } |
| 137 | } |
| 138 | } |
| 139 | |
| 140 | fn convert_token(source: &str, cursor: Cursor) -> CSSTokenizerTestToken { |