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

Function parse_str_lower

crates/css_lexer/src/source_cursor.rs:745–773  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

743
744 #[test]
745 fn parse_str_lower() {
746 let c = Cursor::new(SourceOffset(0), Token::new_ident(true, false, false, 0, 3));
747 assert_eq!(SourceCursor::from(c, "FoO").parse_ascii_lower(Global), "foo");
748 assert_eq!(SourceCursor::from(c, "FOO").parse_ascii_lower(Global), "foo");
749 assert_eq!(SourceCursor::from(c, "foo").parse_ascii_lower(Global), "foo");
750
751 let c = Cursor::new(SourceOffset(0), Token::new_string(QuoteStyle::Single, true, false, 5));
752 assert_eq!(SourceCursor::from(c, "'FoO'").parse_ascii_lower(Global), "foo");
753 assert_eq!(SourceCursor::from(c, "'FOO'").parse_ascii_lower(Global), "foo");
754
755 let c = Cursor::new(SourceOffset(0), Token::new_string(QuoteStyle::Single, false, false, 4));
756 assert_eq!(SourceCursor::from(c, "'FoO").parse_ascii_lower(Global), "foo");
757 assert_eq!(SourceCursor::from(c, "'FOO").parse_ascii_lower(Global), "foo");
758 assert_eq!(SourceCursor::from(c, "'foo").parse_ascii_lower(Global), "foo");
759
760 let c = Cursor::new(SourceOffset(0), Token::new_url(true, false, false, 4, 1, 6));
761 assert_eq!(SourceCursor::from(c, "url(a)").parse_ascii_lower(Global), "a");
762 assert_eq!(SourceCursor::from(c, "url(b)").parse_ascii_lower(Global), "b");
763
764 let c = Cursor::new(SourceOffset(0), Token::new_url(true, false, false, 6, 1, 8));
765 assert_eq!(SourceCursor::from(c, "\\75rl(A)").parse_ascii_lower(Global), "a");
766 assert_eq!(SourceCursor::from(c, "u\\52l(B)").parse_ascii_lower(Global), "b");
767 assert_eq!(SourceCursor::from(c, "ur\\6c(C)").parse_ascii_lower(Global), "c");
768
769 let c = Cursor::new(SourceOffset(0), Token::new_url(true, false, false, 8, 1, 10));
770 assert_eq!(SourceCursor::from(c, "\\75\\52l(A)").parse_ascii_lower(Global), "a");
771 assert_eq!(SourceCursor::from(c, "u\\52\\6c(B)").parse_ascii_lower(Global), "b");
772 assert_eq!(SourceCursor::from(c, "\\75r\\6c(C)").parse_ascii_lower(Global), "c");
773 }
774
775 #[test]
776 fn eq_ignore_ascii_case() {

Callers

nothing calls this directly

Calls 1

SourceOffsetClass · 0.85

Tested by

no test coverage detected