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

Function test_bumpalo_compatibility

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

Source from the content-addressed store, hash-verified

826 #[test]
827 #[cfg(feature = "bumpalo")]
828 fn test_bumpalo_compatibility() {
829 use bumpalo::Bump;
830
831 // Test that Bumpalo's Bump can be used as an allocator
832 let bump = Bump::new();
833 let c = Cursor::new(SourceOffset(0), Token::new_ident(true, false, false, 0, 3));
834
835 // Test that the old interface still works
836 assert_eq!(SourceCursor::from(c, "FoO").parse(&bump), "FoO");
837 assert_eq!(SourceCursor::from(c, "FoO").parse_ascii_lower(&bump), "foo");
838
839 // Test that the new interface works with Bumpalo too
840 assert_eq!(&*SourceCursor::from(c, "FoO").parse(&bump), "FoO");
841 assert_eq!(&*SourceCursor::from(c, "FoO").parse_ascii_lower(&bump), "foo");
842
843 // Test with escape sequences
844 let c = Cursor::new(SourceOffset(0), Token::new_ident(false, false, true, 0, 7));
845 assert_eq!(SourceCursor::from(c, "b\\61\\72").parse(&bump), "bar");
846 assert_eq!(&*SourceCursor::from(c, "b\\61\\72").parse(&bump), "bar");
847 }
848
849 #[test]
850 fn test_compact_ident_with_escapes() {

Callers

nothing calls this directly

Calls 1

SourceOffsetClass · 0.85

Tested by

no test coverage detected