Skip to content

Commit

Permalink
FileConventions.Test: add failing test
Browse files Browse the repository at this point in the history
`Contains()` method catches a lot of false-positives and not
suitable for this situation so we used regex.

Co-authored-by: Parham <[email protected]>
  • Loading branch information
Mersho and parhamsaremi committed Aug 29, 2023
1 parent e6fc879 commit 5358b96
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
let myString = "\"Hello World\""
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
let temp = "Hello World"

match temp with
| "" -> failwith "Empty String"
| _ -> failwith "Non-Empty String"
26 changes: 26 additions & 0 deletions src/FileConventions.Test/FileConventions.Test.fs
Original file line number Diff line number Diff line change
Expand Up @@ -614,6 +614,32 @@ let DefiningEmptyStringsWithDoubleQuotes2() =
Assert.That(DefiningEmptyStringsWithDoubleQuotes fileInfo, Is.EqualTo true)


[<Test>]
let DefiningEmptyStringsWithDoubleQuotes3() =
let fileInfo =
FileInfo(
Path.Combine(
dummyFilesDirectory.FullName,
"DummyScriptWithEmptyString.fsx"
)
)

Assert.That(DefiningEmptyStringsWithDoubleQuotes fileInfo, Is.EqualTo false)


[<Test>]
let DefiningEmptyStringsWithDoubleQuotes4() =
let fileInfo =
FileInfo(
Path.Combine(
dummyFilesDirectory.FullName,
"DummyScriptWithMatchEmptyString.fsx"
)
)

Assert.That(DefiningEmptyStringsWithDoubleQuotes fileInfo, Is.EqualTo false)


[<Test>]
let ProjFilesNamingConvention1() =
let fileInfo =
Expand Down
2 changes: 2 additions & 0 deletions src/FileConventions.Test/FileConventions.Test.fsproj
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@
</ItemGroup>

<ItemGroup>
<None Include="DummyFiles\DummyScriptWithEmptyString.fsx" />
<None Include="DummyFiles\DummyScriptWithMatchEmptyString.fsx" />
<None Include="DummyFiles\DummyFsprojWithAsterisk.fsproj" />
<None Include="DummyFiles\DummyWithShebang.fsx" />
<None Include="DummyFiles\DummyWithWrongShebang.fsx" />
Expand Down

0 comments on commit 5358b96

Please sign in to comment.