Skip to content

Commit

Permalink
Don't escape newline and tab chars.
Browse files Browse the repository at this point in the history
  • Loading branch information
kurtschelfthout committed Sep 26, 2017
1 parent 34cdfb7 commit b77b1a4
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 4 deletions.
3 changes: 2 additions & 1 deletion FsCheck Release Notes.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
### 2.10.3 - To be released
### 2.10.3 - 26 September 2017
* Don't escape newline and tab characters.

### 2.10.2 - 25 September 2017
* Fix stack overflow in Gen.piles, listOf and arrayOf when generating long collections.
Expand Down
2 changes: 1 addition & 1 deletion src/FsCheck/Runner.fs
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ module Runner =
let result = System.Text.StringBuilder()
let mutable escaped = false
s |> String.iter (fun ch ->
if not (Char.IsControl(ch)) then
if not (Char.IsControl(ch)) || ch = '\n' || ch = '\r' || ch = '\t' then
result.Append(ch) |> ignore
else
escaped <- true
Expand Down
4 changes: 2 additions & 2 deletions tests/FsCheck.Test/Runner.fs
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,9 @@ module Runner =

[<Fact>]
let ``should show control characters as character codes``() =
let stringWithControlChar = "1234\001 fadf"
let stringWithControlChar = "\r\n\t1234\001 fadf"
let result = Runner.argumentsToString [stringWithControlChar]
test <@ result.StartsWith("\"1234\\001 fadf") @>
test <@ result.StartsWith("\"\r\n\t1234\\001 fadf") @>

[<Fact>]
let ``should show control characters as character codes for strings nested in other types``() =
Expand Down

0 comments on commit b77b1a4

Please sign in to comment.