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

Function eq_ignore_ascii_case

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

Source from the content-addressed store, hash-verified

774
775 #[test]
776 fn eq_ignore_ascii_case() {
777 let c = Cursor::new(SourceOffset(0), Token::new_ident(false, false, false, 0, 3));
778 assert!(SourceCursor::from(c, "foo").eq_ignore_ascii_case("foo"));
779 assert!(!SourceCursor::from(c, "foo").eq_ignore_ascii_case("bar"));
780 assert!(!SourceCursor::from(c, "fo ").eq_ignore_ascii_case("foo"));
781 assert!(!SourceCursor::from(c, "foo").eq_ignore_ascii_case("fooo"));
782 assert!(!SourceCursor::from(c, "foo").eq_ignore_ascii_case("ғоо"));
783
784 let c = Cursor::new(SourceOffset(0), Token::new_ident(true, false, false, 0, 3));
785 assert!(SourceCursor::from(c, "FoO").eq_ignore_ascii_case("foo"));
786 assert!(SourceCursor::from(c, "FOO").eq_ignore_ascii_case("foo"));
787 assert!(!SourceCursor::from(c, "foo").eq_ignore_ascii_case("bar"));
788 assert!(!SourceCursor::from(c, "fo ").eq_ignore_ascii_case("foo"));
789 assert!(!SourceCursor::from(c, "foo").eq_ignore_ascii_case("fooo"));
790 assert!(!SourceCursor::from(c, "foo").eq_ignore_ascii_case("ғоо"));
791
792 let c = Cursor::new(SourceOffset(3), Token::new_ident(false, false, false, 0, 3));
793 assert!(SourceCursor::from(c, "bar").eq_ignore_ascii_case("bar"));
794
795 let c = Cursor::new(SourceOffset(3), Token::new_ident(false, false, true, 0, 3));
796 assert!(SourceCursor::from(c, "bar").eq_ignore_ascii_case("bar"));
797
798 let c = Cursor::new(SourceOffset(3), Token::new_ident(false, false, true, 0, 5));
799 assert!(SourceCursor::from(c, "b\\61r").eq_ignore_ascii_case("bar"));
800
801 let c = Cursor::new(SourceOffset(3), Token::new_ident(false, false, true, 0, 7));
802 assert!(SourceCursor::from(c, "b\\61\\72").eq_ignore_ascii_case("bar"));
803 }
804
805 #[test]
806 fn write_str() {

Callers

nothing calls this directly

Calls 1

SourceOffsetClass · 0.85

Tested by

no test coverage detected