Skip to content

Commit

Permalink
FileConventions: add failing test
Browse files Browse the repository at this point in the history
Add tests for DefiningEmptyStringsWithDoubleQuotes function.
  • Loading branch information
tehraninasab authored and Mersho committed Aug 17, 2023
1 parent b7a512d commit 50fe215
Show file tree
Hide file tree
Showing 4 changed files with 42 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#!/usr/bin/env -S dotnet fsi

open System
open System.IO

let emptyString = String.Empty
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#!/usr/bin/env -S dotnet fsi

open System
open System.IO

let emptyString = ""
26 changes: 26 additions & 0 deletions src/FileConventions.Test/FileConventions.Test.fs
Original file line number Diff line number Diff line change
Expand Up @@ -586,3 +586,29 @@ let IsExecutableTest2() =
))

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


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

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


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

Assert.That(DefiningEmptyStringsWithDoubleQuotes fileInfo, Is.EqualTo true)
4 changes: 4 additions & 0 deletions src/FileConventions/Library.fs
Original file line number Diff line number Diff line change
Expand Up @@ -390,3 +390,7 @@ let NonVerboseFlags(fileInfo: FileInfo) =
let IsExecutable(fileInfo: FileInfo) =
let hasExecuteAccess = Syscall.access(fileInfo.FullName, AccessModes.X_OK)
hasExecuteAccess = 0

let DefiningEmptyStringsWithDoubleQuotes(fileInfo: FileInfo) =
printfn "File Path: %s" fileInfo.FullName
false

0 comments on commit 50fe215

Please sign in to comment.