Skip to content

Commit

Permalink
Merge pull request #109 from jpsim/jp-fix-stringByTrimmingTrailingCha…
Browse files Browse the repository at this point in the history
…ractersInSet

fix stringByTrimmingTrailingCharactersInSet
  • Loading branch information
jpsim committed Nov 28, 2015
2 parents 8889da5 + a8ae71d commit 3fe3f93
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 1 deletion.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@ None.
[JP Simard](https://github.com/jpsim)
[#65](https://github.com/jpsim/SourceKitten/issues/65)

* Fix `String.stringByTrimmingTrailingCharactersInSet(_:)` returning full string
when all characters matched character set.
[JP Simard](https://github.com/jpsim)


## 0.6.2

Expand Down
2 changes: 1 addition & 1 deletion Source/SourceKittenFramework/String+SourceKitten.swift
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ extension NSString {
return substringWithRange(NSRange(location: 0, length: newLength))
}
}
return self as String
return ""
}

/**
Expand Down
2 changes: 2 additions & 0 deletions Source/SourceKittenFrameworkTests/StringTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ class StringTests: XCTestCase {
func testStringByTrimmingTrailingCharactersInSet() {
XCTAssertEqual("".stringByTrimmingTrailingCharactersInSet(NSCharacterSet.whitespaceAndNewlineCharacterSet()), "")
XCTAssertEqual(" a ".stringByTrimmingTrailingCharactersInSet(NSCharacterSet.whitespaceAndNewlineCharacterSet()), " a")
XCTAssertEqual(" ".stringByTrimmingTrailingCharactersInSet(NSCharacterSet.whitespaceAndNewlineCharacterSet()), "")
XCTAssertEqual("a".stringByTrimmingTrailingCharactersInSet(NSCharacterSet.whitespaceAndNewlineCharacterSet()), "a")
}

func testCommentBody() {
Expand Down

0 comments on commit 3fe3f93

Please sign in to comment.