Skip to content

Commit 5358b96

Browse files
Mershoparhamsaremi
andcommitted
FileConventions.Test: add failing test
`Contains()` method catches a lot of false-positives and not suitable for this situation so we used regex. Co-authored-by: Parham <[email protected]>
1 parent e6fc879 commit 5358b96

File tree

4 files changed

+34
-0
lines changed

4 files changed

+34
-0
lines changed
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
let myString = "\"Hello World\""
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
let temp = "Hello World"
2+
3+
match temp with
4+
| "" -> failwith "Empty String"
5+
| _ -> failwith "Non-Empty String"

src/FileConventions.Test/FileConventions.Test.fs

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -614,6 +614,32 @@ let DefiningEmptyStringsWithDoubleQuotes2() =
614614
Assert.That(DefiningEmptyStringsWithDoubleQuotes fileInfo, Is.EqualTo true)
615615

616616

617+
[<Test>]
618+
let DefiningEmptyStringsWithDoubleQuotes3() =
619+
let fileInfo =
620+
FileInfo(
621+
Path.Combine(
622+
dummyFilesDirectory.FullName,
623+
"DummyScriptWithEmptyString.fsx"
624+
)
625+
)
626+
627+
Assert.That(DefiningEmptyStringsWithDoubleQuotes fileInfo, Is.EqualTo false)
628+
629+
630+
[<Test>]
631+
let DefiningEmptyStringsWithDoubleQuotes4() =
632+
let fileInfo =
633+
FileInfo(
634+
Path.Combine(
635+
dummyFilesDirectory.FullName,
636+
"DummyScriptWithMatchEmptyString.fsx"
637+
)
638+
)
639+
640+
Assert.That(DefiningEmptyStringsWithDoubleQuotes fileInfo, Is.EqualTo false)
641+
642+
617643
[<Test>]
618644
let ProjFilesNamingConvention1() =
619645
let fileInfo =

src/FileConventions.Test/FileConventions.Test.fsproj

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,8 @@
2828
</ItemGroup>
2929

3030
<ItemGroup>
31+
<None Include="DummyFiles\DummyScriptWithEmptyString.fsx" />
32+
<None Include="DummyFiles\DummyScriptWithMatchEmptyString.fsx" />
3133
<None Include="DummyFiles\DummyFsprojWithAsterisk.fsproj" />
3234
<None Include="DummyFiles\DummyWithShebang.fsx" />
3335
<None Include="DummyFiles\DummyWithWrongShebang.fsx" />

0 commit comments

Comments
 (0)