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

Function test_basic

crates/css_parse/src/cursor_ordered_sink.rs:149–165  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

147
148 #[test]
149 fn test_basic() {
150 let source_text = "foo bar";
151 let bump = Bump::default();
152 let mut output = BumpVec::new_in(&bump);
153 {
154 let mut ordered_sink = CursorOrderedSink::new(&bump, &mut output);
155 let lexer = Lexer::new(&EmptyAtomSet::ATOMS, source_text);
156 let mut parser = Parser::new(&bump, source_text, lexer);
157 parser.parse_entirely::<ComponentValues>().output.unwrap().to_cursors(&mut ordered_sink);
158 ordered_sink.flush();
159 }
160 let mut result = String::new();
161 for c in output.iter() {
162 write!(&mut result, "{}", SourceCursor::from(*c, c.str_slice(source_text))).unwrap();
163 }
164 assert_eq!(result, "foo bar");
165 }
166
167 #[test]
168 fn test_manual_flush() {

Callers

nothing calls this directly

Calls 3

flushMethod · 0.80
iterMethod · 0.80
to_cursorsMethod · 0.45

Tested by

no test coverage detected