Tests/OrgCoreTests/PrettyEntitiesTests.swift

4c75f0eea5342f7f5a56227654fb6f40d0ef56e6
orgstar/Tests/OrgCoreTests/PrettyEntitiesTests.swift

17 lines · 858 bytes

 1import Testing
 2@testable import OrgCore
 3
 4struct PrettyEntitiesTests {
 5    @Test func entitiesAndChainedScripts() {
 6        let runs = PrettyEntities.runs(in: "\\alpha + \\beta{} = x_{1}^{2} \\to", subSuperscriptsNeedBraces: true)
 7        #expect(runs == [
 8            .entity(range: 0..<6, display: "α"),
 9            .entity(range: 9..<16, display: "β"),
10            .entity(range: 29..<32, display: "→"),
11            .script(markers: [20..<21, 21..<22, 23..<24], body: 22..<23, superscript: false),
12            .script(markers: [24..<25, 25..<26, 27..<28], body: 26..<27, superscript: true),
13        ])
14        #expect(PrettyEntities.runs(in: "snake_case", subSuperscriptsNeedBraces: true).isEmpty)
15        #expect(PrettyEntities.runs(in: "a_b", subSuperscriptsNeedBraces: false) == [.script(markers: [1..<2], body: 2..<3, superscript: false)])
16    }
17}
Keyboard shortcuts

Global

⌘K
Command palette & jump
/
Focus search
?
Show this help
g d
Dashboard
g e
Explore repositories
g n
Notifications

Repository & editor

t
Find file in repository
y
Copy immutable SHA permalink
g c
Code tab
g i
Issues tab
g m
Merge requests tab
g b
Builds tab
⌘↵
Submit active form