-
Notifications
You must be signed in to change notification settings - Fork 15
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Bug] Seems to break with certain emoji strings #28
Comments
Here's the code in case you wanna check it out yourself: let breakingString = " *hello* . *hello* cncnc cncnc *hello* hmm\n *hello* 🦌🐎🦌🐎\n *hello* Screen Shot 2017-10-12 at 11.04.58 AM.png *hello* vVe2keakU8.gif *hello* *hello* "
let parser = Parser()
let parseExpectation = expectation(description: "parsing expectation")
parser.add(pattern: MDEmphasisPattern()) { (str, attributes) in
return MatchedResponse(string: str, attributes: [:])
}
parser.process(text: breakingString) { (attrString) in
guard let _ = attrString else {
return
}
parseExpectation.fulfill()
}
wait(for: [parseExpectation], timeout: 10.0)
|
Is fixed in #29 if you'd like to take a look 😄 |
Hey @codeOfRobin I still had the issue with your PR. |
Interesting @CWalig 🤔. Could you point me to a failing test case so I can check it out? |
What about? func testSingleEmoji() {
let breakingString = "🐎🐎 *hello* "
let parseExpectation = expectation(description: "parsing expectation")
parser.add(pattern: MDEmphasisPattern()) { (str, attributes) in
return MatchedResponse(string: str, attributes: [NSAttributedStringKey.font: UIFont.boldSystemFont(ofSize: 10.0)])
}
parser.process(text: breakingString) { (attrString) in
guard let attrString = attrString else {
return
}
let rangeToCompare = NSRange.init(location: 4, length: 5)
attrString.enumerateAttributes(in: NSRange(location: 0, length: attrString.string.count), options: [.longestEffectiveRangeNotRequired], using: { (value, range, isStop) in
if range == rangeToCompare {
parseExpectation.fulfill()
}
})
}
wait(for: [parseExpectation], timeout: 10.0)
} Let me know if I am missing something 👍 |
@CWalig I wrote a test case specifically to make sure it worked 🤔 https://github.com/daltoniam/bumblebee/pull/29/files#diff-3c95b3eb97e5e17dbd3db4ad8fa45c2e |
I know, this one has a different |
Hey @daltoniam !
I just tried running an emoji-laden string past
MDEmphasisPattern
, and it seems to crash with anFatal error: cannot increment beyond endIndex
inbumblebee/Sources/bumblebee.swift
Line 90 in 842fb80
I have a fork with a test case added, but I've messed with a lot of build settings(from xcodegen: https://github.com/yonaskolb/XcodeGen) and don't think you'd want to merge. Check this out if you're interested though: codeOfRobin@62d6c4d
I'll try fixing it in my spare time, but I'd love to hear your thoughts on it!
The text was updated successfully, but these errors were encountered: