Skip to content

Commit

Permalink
FileConventions: add tests
Browse files Browse the repository at this point in the history
Add tests for
NonVerboseFlagsInGitHubCI
function.
  • Loading branch information
tehraninasab committed Mar 28, 2023
1 parent 73ada7e commit 7e9f86f
Show file tree
Hide file tree
Showing 4 changed files with 52 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/FileConventions.Test/DummyFiles/DummyCIWithNonVerboseFlag.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
name: CI

on: [push, pull_request]

jobs:
file-conventions:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Print apt version
run: apt -v
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
name: CI

on: [push, pull_request]

jobs:
file-conventions:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Print apt version
run: apt --version
26 changes: 26 additions & 0 deletions src/FileConventions.Test/FileConventions.Test.fs
Original file line number Diff line number Diff line change
Expand Up @@ -255,3 +255,29 @@ let HasBinaryContentTest3() =
))

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


[<Test>]
let NonVerboseFlagsInGitHubCI1() =
let fileInfo =
(FileInfo(
Path.Combine(
dummyFilesDirectory.FullName,
"DummyCIWithNonVerboseFlag.yml"
)
))

Assert.That(NonVerboseFlagsInGitHubCI fileInfo, Is.EqualTo true)


[<Test>]
let NonVerboseFlagsInGitHubCI2() =
let fileInfo =
(FileInfo(
Path.Combine(
dummyFilesDirectory.FullName,
"DummyCIWithoutNonVerboseFlags.yml"
)
))

Assert.That(NonVerboseFlagsInGitHubCI fileInfo, Is.EqualTo false)
4 changes: 4 additions & 0 deletions src/FileConventions/Library.fs
Original file line number Diff line number Diff line change
Expand Up @@ -104,3 +104,7 @@ let EolAtEof(fileInfo: FileInfo) =
False
else
True

let NonVerboseFlagsInGitHubCI(fileInfo: FileInfo) =
assert (fileInfo.FullName.EndsWith(".yml"))
false

0 comments on commit 7e9f86f

Please sign in to comment.