Skip to content

Commit 4fa4de0

Browse files
authored
Make Expect.isNotEmpty accept whitespace strings (#452)
Close #428
1 parent 14deae1 commit 4fa4de0

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

Expecto.Tests/Tests.fs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -849,6 +849,10 @@ let expecto =
849849
testCase "when string is empty" (fun _ ->
850850
Expect.isNotEmpty "" "should fail because string is empty"
851851
) |> assertTestFails
852+
853+
testCase "when string is whitespace" (fun _ ->
854+
Expect.isNotEmpty " " "should pass because string is whitespace"
855+
)
852856
]
853857

854858
testList "string isnotwhitespace" [
@@ -858,10 +862,6 @@ let expecto =
858862
testCase "when string is empty" (fun _ ->
859863
Expect.isNotEmpty "" "should fail because string is empty"
860864
) |> assertTestFails
861-
862-
testCase "when string is whitespace" (fun _ ->
863-
Expect.isNotEmpty " " "should fail because string is whitespace"
864-
) |> assertTestFails
865865
]
866866

867867
testList "string matches pattern for isMatch" [

Expecto/Expect.fs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -260,7 +260,7 @@ let isNotInfinity actual message =
260260
/// Expect the passed string not to be empty.
261261
let isNotEmpty (actual : string) message =
262262
isNotNull actual message
263-
if String.IsNullOrWhiteSpace actual then Tests.failtestf "%s. Should not be empty." message
263+
if String.IsNullOrEmpty actual then Tests.failtestf "%s. Should not be empty." message
264264

265265
/// Expect the passed string is not whitespace
266266
let isNotWhitespace (actual : string) message =

0 commit comments

Comments
 (0)