-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathBasicTests.swift
More file actions
34 lines (28 loc) · 915 Bytes
/
BasicTests.swift
File metadata and controls
34 lines (28 loc) · 915 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
import Testing
@testable import SyntaxKit
struct BasicTests {
@Test func testBlackjackCardExample() throws {
let blackjackCard = Struct("BlackjackCard") {
Enum("Suit") {
EnumCase("spades").equals("♠")
EnumCase("hearts").equals("♡")
EnumCase("diamonds").equals("♢")
EnumCase("clubs").equals("♣")
}.inherits("Character")
}
let expected = """
struct BlackjackCard {
enum Suit: Character {
case spades = "♠"
case hearts = "♡"
case diamonds = "♢"
case clubs = "♣"
}
}
"""
// Normalize whitespace, remove comments and modifiers, and normalize colon spacing
let normalizedGenerated = blackjackCard.syntax.description.normalize()
let normalizedExpected = expected.normalize()
#expect(normalizedGenerated == normalizedExpected)
}
}