Skip to content

Commit

Permalink
quickstart
Browse files Browse the repository at this point in the history
  • Loading branch information
vincentremond committed Jan 2, 2025
1 parent 8261d43 commit b3bb6e0
Show file tree
Hide file tree
Showing 17 changed files with 1,619 additions and 1,626 deletions.
10 changes: 6 additions & 4 deletions .config/dotnet-tools.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,18 @@
"isRoot": true,
"tools": {
"fantomas": {
"version": "6.2.3",
"version": "6.3.16",
"commands": [
"fantomas"
]
],
"rollForward": false
},
"paket": {
"version": "8.0.0",
"version": "9.0.2",
"commands": [
"paket"
]
],
"rollForward": false
}
}
}
2 changes: 0 additions & 2 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
root = true

[paket.*]
insert_final_newline = false

Expand Down
1,002 changes: 505 additions & 497 deletions .paket/Paket.Restore.targets

Large diffs are not rendered by default.

4 changes: 0 additions & 4 deletions Install-as-dotnet-tool.ps1

This file was deleted.

2 changes: 2 additions & 0 deletions build.cmd
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,5 @@

dotnet tool restore
dotnet build -- %*

AddToPath ./extLauncher/bin/Debug/
152 changes: 76 additions & 76 deletions extLauncher.Tests/AppTests.fs
Original file line number Diff line number Diff line change
Expand Up @@ -5,91 +5,91 @@ open Xunit

[<Fact>]
let ``should load a folder`` () =
let folderPath = FolderPath "/test"
let pattern = "*.ext"

let folder =
let loadFiles _ _ = [|
FilePath "/test/file2.ext", FileName "file2"
FilePath "/test/file1.ext", FileName "file1"
|]

App.loadFolder loadFiles {
Path = folderPath
Pattern = Pattern.init pattern false
Launchers = Array.empty
}

folder
=! Some {
Path = folderPath
Pattern = Pattern.init pattern false
Files = [|
File.create (FilePath "/test/file1.ext") (FileName "file1")
File.create (FilePath "/test/file2.ext") (FileName "file2")
|]
Launchers = Array.empty
let folderPath = FolderPath "/test"
let pattern = "*.ext"

let folder =
let loadFiles _ _ = [|
FilePath "/test/file2.ext", FileName "file2"
FilePath "/test/file1.ext", FileName "file1"
|]

App.loadFolder loadFiles {
Path = folderPath
Pattern = Pattern.init pattern false
Launchers = Array.empty
}

folder
=! Some {
Path = folderPath
Pattern = Pattern.init pattern false
Files = [|
File.create (FilePath "/test/file1.ext") (FileName "file1")
File.create (FilePath "/test/file2.ext") (FileName "file2")
|]
Launchers = Array.empty
}

[<Fact>]
let ``should not load a folder if no result`` () =
let folder =
let loadFiles _ _ = Array.empty
let folder =
let loadFiles _ _ = Array.empty

App.loadFolder loadFiles {
Path = FolderPath ""
Pattern = Pattern.init "" false
Launchers = Array.empty
}
App.loadFolder loadFiles {
Path = FolderPath ""
Pattern = Pattern.init "" false
Launchers = Array.empty
}

folder =! None
folder =! None

[<Fact>]
let ``refresh should synchronize files`` () =
let newFolder =
let loadFiles _ _ = [|
FilePath "file1", FileName ""
FilePath "file3", FileName ""
|]

let save = id

{
Path = FolderPath ""
Pattern = Pattern.init "" false
Files = [|
File.create (FilePath "file1") (FileName "")
File.create (FilePath "file2") (FileName "")
|]
Launchers = Array.empty
}
|> App.refresh loadFiles save
|> Option.get

newFolder.Files.[0].Path.value =! "file1"
newFolder.Files.[1].Path.value =! "file3"
let newFolder =
let loadFiles _ _ = [|
FilePath "file1", FileName ""
FilePath "file3", FileName ""
|]

let save = id

{
Path = FolderPath ""
Pattern = Pattern.init "" false
Files = [|
File.create (FilePath "file1") (FileName "")
File.create (FilePath "file2") (FileName "")
|]
Launchers = Array.empty
}
|> App.refresh loadFiles save
|> Option.get

newFolder.Files.[0].Path.value =! "file1"
newFolder.Files.[1].Path.value =! "file3"

[<Fact>]
let ``refresh should keep triggers`` () =
let newFolder =
let loadFiles _ _ = [|
FilePath "file1", FileName ""
FilePath "file2", FileName ""
|]

let save = id

{
Path = FolderPath ""
Pattern = Pattern.init "" false
Files = [|
File.create (FilePath "file1") (FileName "") |> File.triggered
File.create (FilePath "file2") (FileName "")
|]
Launchers = Array.empty
}
|> App.refresh loadFiles save
|> Option.get

newFolder.Files.[0].Triggered =! 1
newFolder.Files.[1].Triggered =! 0
let newFolder =
let loadFiles _ _ = [|
FilePath "file1", FileName ""
FilePath "file2", FileName ""
|]

let save = id

{
Path = FolderPath ""
Pattern = Pattern.init "" false
Files = [|
File.create (FilePath "file1") (FileName "") |> File.triggered
File.create (FilePath "file2") (FileName "")
|]
Launchers = Array.empty
}
|> App.refresh loadFiles save
|> Option.get

newFolder.Files.[0].Triggered =! 1
newFolder.Files.[1].Triggered =! 0
Loading

0 comments on commit b3bb6e0

Please sign in to comment.