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
  e2d0353b_3146_caf8_f9a3_a0d717632753["test_cursor()"]
  9ec35898_57b1_8a60_b49f_7eb7a0096aa4["advance_by()"]
  e2d0353b_3146_caf8_f9a3_a0d717632753 -->|calls| 9ec35898_57b1_8a60_b49f_7eb7a0096aa4
  style e2d0353b_3146_caf8_f9a3_a0d717632753 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.
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