Skip to content

Commit

Permalink
Allows any character except # for file names in SnapKit constraint de…
Browse files Browse the repository at this point in the history
…scriptions (#16)
  • Loading branch information
johnpatrickmorgan committed Mar 12, 2019
1 parent 298d39b commit b750462
Show file tree
Hide file tree
Showing 4 changed files with 57 additions and 2 deletions.
2 changes: 1 addition & 1 deletion Sources/App/Parsing/ConstraintsParser+Instances.swift
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ private extension ConstraintsParser {
.named("memory address")
static let identifier = many(identifierCharacter.butNot(sqm), boundedBy: sqm).asString()
.named("identifier")
static let fileLocation = character("@").skipThen(many(character(condition: isClassNameCharacter), untilSkipping: character("#")).asString()).then(integer)
static let fileLocation = character("@").skipThen(many(anyCharacter(), untilSkipping: character("#")).asString()).then(integer)
.named("file location")

static let partialIdentifierCharacter = characterNot(in: "[]|()<>\":")
Expand Down
4 changes: 4 additions & 0 deletions Tests/AppTests/Inputs/Input+GitHubIssues.swift
Original file line number Diff line number Diff line change
Expand Up @@ -79,4 +79,8 @@ extension Input {
"<NSLayoutConstraint:0x283c8c8c0 UILayoutGuide:0x2826f9880'UIViewLayoutMarginsGuide'.bottom == UIButton:0x10f755100'Cancel'.bottom NSSpace(0) (active)>",
"<NSLayoutConstraint:0x283c8c730 'UIView-bottomMargin-guide-constraint' V:[UILayoutGuide:0x2826f9880'UIViewLayoutMarginsGuide']-(42)-| (active, names: '|':UIView:0x10f754f20 )>"
"""

static let issue16 = """
"<SnapKit.LayoutConstraint:0x7feb4e8fa260@PViewController+Ext.swift#21 App_Debug.StackView:0x7feb4e8d58b0.leading == UILayoutGuide:0x7feb50d2aa70.leading + 10.0>"
"""
}
3 changes: 2 additions & 1 deletion Tests/AppTests/ParserTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,8 @@ class ParserTests: XCTestCase {
Input.issue4,
Input.issue5,
Input.issue10,
Input.issue13
Input.issue13,
Input.issue16
]

for input in inputs {
Expand Down
50 changes: 50 additions & 0 deletions Tests/AppTests/__Snapshots__/ParserTests/testGitHubIssues.7.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
{
"constraints" : [
{
"constant" : {
"prefix" : "+ ",
"value" : "10"
},
"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.",
"first" : {
"attribute" : {
"includesMargin" : false,
"name" : "leading"
},
"instance" : {
"address" : "0x7feb4e8d58b0",
"className" : "App_Debug.StackView",
"color" : "rgb(230,126,34)",
"initial" : "S",
"name" : "StackView",
"suffix" : ""
}
},
"identity" : {
"address" : "0x7feb4e8fa260",
"className" : "SnapKit.LayoutConstraint",
"color" : "rgb(26,188,156)",
"initial" : "L",
"name" : "LayoutConstraint"
},
"relation" : "==",
"second" : {
"attribute" : {
"includesMargin" : false,
"name" : "leading"
},
"instance" : {
"address" : "0x7feb50d2aa70",
"className" : "UILayoutGuide",
"color" : "rgb(245,215,110)",
"initial" : "L",
"name" : "LayoutGuide",
"suffix" : ""
}
}
}
],
"footnotes" : [

]
}

0 comments on commit b750462

Please sign in to comment.