MCPcopy Create free account
hub / github.com/csskit/csskit / new

Method new

crates/css_lexer/tests/css-tokenizer-tests.rs:125–137  ·  view source on GitHub ↗
(source_path: PathBuf)

Source from the content-addressed store, hash-verified

123
124impl 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
140fn convert_token(source: &str, cursor: Cursor) -> CSSTokenizerTestToken {

Callers

nothing calls this directly

Calls 2

cloneMethod · 0.80
as_strMethod · 0.45

Tested by

no test coverage detected