Skip to content

Commit b750462

Browse files
Allows any character except # for file names in SnapKit constraint descriptions (#16)
1 parent 298d39b commit b750462

File tree

4 files changed

+57
-2
lines changed

4 files changed

+57
-2
lines changed

Sources/App/Parsing/ConstraintsParser+Instances.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ private extension ConstraintsParser {
3535
.named("memory address")
3636
static let identifier = many(identifierCharacter.butNot(sqm), boundedBy: sqm).asString()
3737
.named("identifier")
38-
static let fileLocation = character("@").skipThen(many(character(condition: isClassNameCharacter), untilSkipping: character("#")).asString()).then(integer)
38+
static let fileLocation = character("@").skipThen(many(anyCharacter(), untilSkipping: character("#")).asString()).then(integer)
3939
.named("file location")
4040

4141
static let partialIdentifierCharacter = characterNot(in: "[]|()<>\":")

Tests/AppTests/Inputs/Input+GitHubIssues.swift

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,4 +79,8 @@ extension Input {
7979
"<NSLayoutConstraint:0x283c8c8c0 UILayoutGuide:0x2826f9880'UIViewLayoutMarginsGuide'.bottom == UIButton:0x10f755100'Cancel'.bottom NSSpace(0) (active)>",
8080
"<NSLayoutConstraint:0x283c8c730 'UIView-bottomMargin-guide-constraint' V:[UILayoutGuide:0x2826f9880'UIViewLayoutMarginsGuide']-(42)-| (active, names: '|':UIView:0x10f754f20 )>"
8181
"""
82+
83+
static let issue16 = """
84+
"<SnapKit.LayoutConstraint:0x7feb4e8fa260@PViewController+Ext.swift#21 App_Debug.StackView:0x7feb4e8d58b0.leading == UILayoutGuide:0x7feb50d2aa70.leading + 10.0>"
85+
"""
8286
}

Tests/AppTests/ParserTests.swift

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,8 @@ class ParserTests: XCTestCase {
3737
Input.issue4,
3838
Input.issue5,
3939
Input.issue10,
40-
Input.issue13
40+
Input.issue13,
41+
Input.issue16
4142
]
4243

4344
for input in inputs {
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
{
2+
"constraints" : [
3+
{
4+
"constant" : {
5+
"prefix" : "+ ",
6+
"value" : "10"
7+
},
8+
"description" : "<code style=\"box-shadow: 0px -1px 0px #E67E22 inset; padding-bottom: 1px;\">StackView<\/code>'s leading edge should equal <code style=\"box-shadow: 0px -1px 0px #F5D76E inset; padding-bottom: 1px;\">LayoutGuide<\/code>'s leading edge plus 10.",
9+
"first" : {
10+
"attribute" : {
11+
"includesMargin" : false,
12+
"name" : "leading"
13+
},
14+
"instance" : {
15+
"address" : "0x7feb4e8d58b0",
16+
"className" : "App_Debug.StackView",
17+
"color" : "rgb(230,126,34)",
18+
"initial" : "S",
19+
"name" : "StackView",
20+
"suffix" : ""
21+
}
22+
},
23+
"identity" : {
24+
"address" : "0x7feb4e8fa260",
25+
"className" : "SnapKit.LayoutConstraint",
26+
"color" : "rgb(26,188,156)",
27+
"initial" : "L",
28+
"name" : "LayoutConstraint"
29+
},
30+
"relation" : "==",
31+
"second" : {
32+
"attribute" : {
33+
"includesMargin" : false,
34+
"name" : "leading"
35+
},
36+
"instance" : {
37+
"address" : "0x7feb50d2aa70",
38+
"className" : "UILayoutGuide",
39+
"color" : "rgb(245,215,110)",
40+
"initial" : "L",
41+
"name" : "LayoutGuide",
42+
"suffix" : ""
43+
}
44+
}
45+
}
46+
],
47+
"footnotes" : [
48+
49+
]
50+
}

0 commit comments

Comments
 (0)