Home / Function/ test_cursor() — tailwindcss Function Reference

test_cursor() — tailwindcss Function Reference

Architecture documentation for the test_cursor() function in cursor.rs from the tailwindcss codebase.

Entity Profile

Dependency Diagram

graph TD
  e9f56998_2843_af32_c907_02944d42c626["test_cursor()"]
  3d889371_52ae_87e1_810f_7e71098819d9["cursor.rs"]
  e9f56998_2843_af32_c907_02944d42c626 -->|defined in| 3d889371_52ae_87e1_810f_7e71098819d9
  35afea5f_3812_945e_174e_7962259eb013["advance_by()"]
  e9f56998_2843_af32_c907_02944d42c626 -->|calls| 35afea5f_3812_945e_174e_7962259eb013
  style e9f56998_2843_af32_c907_02944d42c626 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

crates/oxide/src/cursor.rs lines 125–159

    fn test_cursor() {
        let mut cursor = Cursor::new(b"hello world");
        assert_eq!(cursor.pos, 0);
        assert!(cursor.at_start);
        assert!(!cursor.at_end);
        assert_eq!(cursor.prev, 0x00);
        assert_eq!(cursor.curr, b'h');
        assert_eq!(cursor.next, b'e');

        cursor.advance_by(1);
        assert_eq!(cursor.pos, 1);
        assert!(!cursor.at_start);
        assert!(!cursor.at_end);
        assert_eq!(cursor.prev, b'h');
        assert_eq!(cursor.curr, b'e');
        assert_eq!(cursor.next, b'l');

        // Advancing too far should stop at the end
        cursor.advance_by(10);
        assert_eq!(cursor.pos, 11);
        assert!(!cursor.at_start);
        assert!(cursor.at_end);
        assert_eq!(cursor.prev, b'd');
        assert_eq!(cursor.curr, 0x00);
        assert_eq!(cursor.next, 0x00);

        // Can't advance past the end
        cursor.advance_by(1);
        assert_eq!(cursor.pos, 11);
        assert!(!cursor.at_start);
        assert!(cursor.at_end);
        assert_eq!(cursor.prev, b'd');
        assert_eq!(cursor.curr, 0x00);
        assert_eq!(cursor.next, 0x00);
    }

Domain

Subdomains

Calls

Frequently Asked Questions

What does test_cursor() do?
test_cursor() is a function in the tailwindcss codebase, defined in crates/oxide/src/cursor.rs.
Where is test_cursor() defined?
test_cursor() is defined in crates/oxide/src/cursor.rs at line 125.
What does test_cursor() call?
test_cursor() calls 1 function(s): advance_by.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free