segment.test.ts — tailwindcss Source File
Architecture documentation for segment.test.ts, a typescript file in the tailwindcss codebase. 3 imports, 0 dependents.
Entity Profile
Dependency Diagram
graph LR c5aac7e4_ea0b_b34c_2625_32797bdafae4["segment.test.ts"] ef204000_8998_5a6c_5455_324b37624713["segment.ts"] c5aac7e4_ea0b_b34c_2625_32797bdafae4 --> ef204000_8998_5a6c_5455_324b37624713 f712ed47_45d4_4e5a_dd73_fdefa1da71da["segment"] c5aac7e4_ea0b_b34c_2625_32797bdafae4 --> f712ed47_45d4_4e5a_dd73_fdefa1da71da 696bd648_5f24_1b59_8e8b_7a97a692869e["vitest"] c5aac7e4_ea0b_b34c_2625_32797bdafae4 --> 696bd648_5f24_1b59_8e8b_7a97a692869e style c5aac7e4_ea0b_b34c_2625_32797bdafae4 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
import { expect, it } from 'vitest'
import { segment } from './segment'
it('should result in a single segment when the separator is not present', () => {
expect(segment('foo', ':')).toEqual(['foo'])
})
it('should split by the separator', () => {
expect(segment('foo:bar:baz', ':')).toEqual(['foo', 'bar', 'baz'])
})
it('should not split inside of parens', () => {
expect(segment('a:(b:c):d', ':')).toEqual(['a', '(b:c)', 'd'])
})
it('should not split inside of brackets', () => {
expect(segment('a:[b:c]:d', ':')).toEqual(['a', '[b:c]', 'd'])
})
it('should not split inside of curlies', () => {
expect(segment('a:{b:c}:d', ':')).toEqual(['a', '{b:c}', 'd'])
})
it('should not split inside of double quotes', () => {
expect(segment('a:"b:c":d', ':')).toEqual(['a', '"b:c"', 'd'])
})
it('should not split inside of single quotes', () => {
expect(segment("a:'b:c':d", ':')).toEqual(['a', "'b:c'", 'd'])
})
it('should not crash when double quotes are unbalanced', () => {
expect(segment('a:"b:c:d', ':')).toEqual(['a', '"b:c:d'])
})
it('should not crash when single quotes are unbalanced', () => {
expect(segment("a:'b:c:d", ':')).toEqual(['a', "'b:c:d"])
})
it('should skip escaped double quotes', () => {
expect(segment(String.raw`a:"b:c\":d":e`, ':')).toEqual(['a', String.raw`"b:c\":d"`, 'e'])
})
it('should skip escaped single quotes', () => {
expect(segment(String.raw`a:'b:c\':d':e`, ':')).toEqual(['a', String.raw`'b:c\':d'`, 'e'])
})
it('should split by the escape sequence which is escape as well', () => {
expect(segment('a\\b\\c\\d', '\\')).toEqual(['a', 'b', 'c', 'd'])
expect(segment('a\\(b\\c)\\d', '\\')).toEqual(['a', '(b\\c)', 'd'])
expect(segment('a\\[b\\c]\\d', '\\')).toEqual(['a', '[b\\c]', 'd'])
expect(segment('a\\{b\\c}\\d', '\\')).toEqual(['a', '{b\\c}', 'd'])
})
Domain
Dependencies
- segment
- segment.ts
- vitest
Source
Frequently Asked Questions
What does segment.test.ts do?
segment.test.ts is a source file in the tailwindcss codebase, written in typescript. It belongs to the OxideEngine domain.
What does segment.test.ts depend on?
segment.test.ts imports 3 module(s): segment, segment.ts, vitest.
Where is segment.test.ts in the architecture?
segment.test.ts is located at packages/tailwindcss/src/utils/segment.test.ts (domain: OxideEngine, directory: packages/tailwindcss/src/utils).
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free