Skip to content

Commit

Permalink
upgrade packages
Browse files Browse the repository at this point in the history
  • Loading branch information
vincentremond committed Jan 11, 2024
1 parent 1aa325d commit 8261d43
Show file tree
Hide file tree
Showing 16 changed files with 1,391 additions and 116 deletions.
12 changes: 6 additions & 6 deletions .config/dotnet-tools.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,16 @@
"version": 1,
"isRoot": true,
"tools": {
"extLauncher": {
"version": "1.0.0",
"fantomas": {
"version": "6.2.3",
"commands": [
"extLauncher"
"fantomas"
]
},
"fantomas": {
"version": "6.1.1",
"paket": {
"version": "8.0.0",
"commands": [
"fantomas"
"paket"
]
}
}
Expand Down
12 changes: 11 additions & 1 deletion .editorconfig
Original file line number Diff line number Diff line change
@@ -1,4 +1,14 @@
root = true

[paket.*]
insert_final_newline = false

[*.{fs,fsx}]
fsharp_multiline_bracket_style = stroustrup
fsharp_multi_line_lambda_closing_newline = true

fsharp_bar_before_discriminated_union_declaration = true
fsharp_keep_max_number_of_blank_lines = 1
fsharp_record_multiline_formatter = number_of_items
fsharp_max_record_number_of_items = 1
fsharp_array_or_list_multiline_formatter = number_of_items
fsharp_max_array_or_list_number_of_items = 1
557 changes: 557 additions & 0 deletions .paket/Paket.Restore.targets

Large diffs are not rendered by default.

4 changes: 4 additions & 0 deletions build.cmd
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
@ECHO OFF

dotnet tool restore
dotnet build -- %*
12 changes: 10 additions & 2 deletions extLauncher.Tests/AppTests.fs
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,11 @@ let ``should not load a folder if no result`` () =
[<Fact>]
let ``refresh should synchronize files`` () =
let newFolder =
let loadFiles _ _ = [| FilePath "file1", FileName ""; FilePath "file3", FileName "" |]
let loadFiles _ _ = [|
FilePath "file1", FileName ""
FilePath "file3", FileName ""
|]

let save = id

{
Expand All @@ -68,7 +72,11 @@ let ``refresh should synchronize files`` () =
[<Fact>]
let ``refresh should keep triggers`` () =
let newFolder =
let loadFiles _ _ = [| FilePath "file1", FileName ""; FilePath "file2", FileName "" |]
let loadFiles _ _ = [|
FilePath "file1", FileName ""
FilePath "file2", FileName ""
|]

let save = id

{
Expand Down
126 changes: 109 additions & 17 deletions extLauncher.Tests/ConsoleTests.fs
Original file line number Diff line number Diff line change
Expand Up @@ -81,67 +81,127 @@ let ``prompt should print choices`` () =
let term = newTerminal keyReader lines

let _ =
fun _ -> [| 1; 2; 3 |]
fun _ -> [|
1
2
3
|]
|> Console.prompt term PromptTitle (sprintf "%i") 5

List.ofSeq lines =! printedLines 5 3 1

[<Fact>]
let ``prompt should go down`` () =
let lines = ResizeArray()
let keyReader = Queue [ downKey; escapeKey ]

let keyReader =
Queue [
downKey
escapeKey
]

let term = newTerminal keyReader lines

let _ =
fun _ -> [| 1; 2; 3 |]
fun _ -> [|
1
2
3
|]
|> Console.prompt term PromptTitle (sprintf "%i") 5

List.ofSeq lines =! printedLines 5 3 2

[<Fact>]
let ``prompt should go up`` () =
let lines = ResizeArray()
let keyReader = Queue [ downKey; upKey; escapeKey ]

let keyReader =
Queue [
downKey
upKey
escapeKey
]

let term = newTerminal keyReader lines

let _ =
fun _ -> [| 1; 2; 3 |]
fun _ -> [|
1
2
3
|]
|> Console.prompt term PromptTitle (sprintf "%i") 5

List.ofSeq lines =! printedLines 5 3 1

[<Fact>]
let ``prompt should stay up`` () =
let lines = ResizeArray()
let keyReader = Queue [ upKey; upKey; escapeKey ]

let keyReader =
Queue [
upKey
upKey
escapeKey
]

let term = newTerminal keyReader lines

let _ =
fun _ -> [| 1; 2; 3 |]
fun _ -> [|
1
2
3
|]
|> Console.prompt term PromptTitle (sprintf "%i") 5

List.ofSeq lines =! printedLines 5 3 1

[<Fact>]
let ``prompt should stay down`` () =
let lines = ResizeArray()
let keyReader = Queue [ downKey; downKey; downKey; downKey; downKey; escapeKey ]

let keyReader =
Queue [
downKey
downKey
downKey
downKey
downKey
escapeKey
]

let term = newTerminal keyReader lines

let _ =
fun _ -> [| 1; 2; 3 |]
fun _ -> [|
1
2
3
|]
|> Console.prompt term PromptTitle (sprintf "%i") 5

List.ofSeq lines =! printedLines 5 3 3

[<Fact>]
let ``prompt should choose the second choice and clear`` () =
let lines = ResizeArray()
let keyReader = Queue [ downKey; enterKey ]

let keyReader =
Queue [
downKey
enterKey
]

let term = newTerminal keyReader lines

let chosen =
fun _ -> [| 1; 2; 3 |]
fun _ -> [|
1
2
3
|]
|> Console.prompt term PromptTitle (sprintf "%i") 5

chosen =! Some 2
Expand All @@ -157,16 +217,33 @@ let ``prompt should print error if no match`` () =
fun _ -> Array.empty
|> Console.prompt term PromptTitle (sprintf "%i") 1

List.ofSeq lines =! [ PrintedTitle; "No items match your search." ]
List.ofSeq lines
=! [
PrintedTitle
"No items match your search."
]

[<Fact>]
let ``prompt should print the search title`` () =
let lines = ResizeArray()
let keyReader = Queue [ aKey 't'; aKey 'e'; aKey 's'; aKey 't'; escapeKey ]

let keyReader =
Queue [
aKey 't'
aKey 'e'
aKey 's'
aKey 't'
escapeKey
]

let term = newTerminal keyReader lines

let _ =
fun _ -> [| 1; 2; 3 |]
fun _ -> [|
1
2
3
|]
|> Console.prompt term PromptTitle (sprintf "%i") 1

Seq.head lines =! $"%s{PrintedTitle}test"
Expand All @@ -176,12 +253,23 @@ let ``prompt should print the search chars supporting backspace`` () =
let lines = ResizeArray()

let keyReader =
Queue [ aKey 't'; aKey 'e'; backspaceKey; aKey 's'; aKey 't'; escapeKey ]
Queue [
aKey 't'
aKey 'e'
backspaceKey
aKey 's'
aKey 't'
escapeKey
]

let term = newTerminal keyReader lines

let _ =
fun _ -> [| 1; 2; 3 |]
fun _ -> [|
1
2
3
|]
|> Console.prompt term PromptTitle (sprintf "%i") 1

Seq.head lines =! $"%s{PrintedTitle}tst"
Expand All @@ -196,7 +284,11 @@ let ``prompt should clear when exit`` () =
let term = newTerminal keyReader lines

let _ =
fun _ -> [| 1; 2; 3 |]
fun _ -> [|
1
2
3
|]
|> Console.prompt term PromptTitle (sprintf "%i") 5

Seq.forall ((=) "") lines =! true
25 changes: 5 additions & 20 deletions extLauncher.Tests/DomainTests.fs
Original file line number Diff line number Diff line change
Expand Up @@ -11,33 +11,21 @@ let ``File with the same Path should be equal`` (file1: File) (file2: File) =

[<Property>]
let ``File with different Path should not be equal`` (file1: File) (file2: File) =
let file1 = {
file1 with
Path = Guid.NewGuid().ToString() |> FilePath
}
let file1 = { file1 with Path = Guid.NewGuid().ToString() |> FilePath }

let file2 = {
file2 with
Path = Guid.NewGuid().ToString() |> FilePath
}
let file2 = { file2 with Path = Guid.NewGuid().ToString() |> FilePath }

file1 <>! file2

[<Property>]
let ``File with a higher trigger should precede in the sort order`` (file1: File) (file2: File) =
let file1 = {
file1 with
Triggered = file2.Triggered + 1
}
let file1 = { file1 with Triggered = file2.Triggered + 1 }

compare file1 file2 =! -1

[<Property>]
let ``File with a lower trigger should follow in the sort order`` (file1: File) (file2: File) =
let file1 = {
file1 with
Triggered = file2.Triggered - 1
}
let file1 = { file1 with Triggered = file2.Triggered - 1 }

compare file1 file2 =! 1

Expand All @@ -59,10 +47,7 @@ let ``File with the same trigger should be sorted alphabetically`` (file1: File)

[<Property>]
let ``searchByName should search for the containing string ignoring case`` (file: File) (files: File array) =
let file = {
file with
Name = FileName "Hello World"
}
let file = { file with Name = FileName "Hello World" }

let files = Array.insertAt 0 file files
Helpers.searchByName files (fun f -> f.Name.value) "world" =! [| file |]
29 changes: 7 additions & 22 deletions extLauncher.Tests/extLauncher.Tests.fsproj
Original file line number Diff line number Diff line change
@@ -1,36 +1,21 @@
<?xml version="1.0" encoding="utf-8"?>
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>

<TargetFramework>net8.0</TargetFramework>
<IsPackable>false</IsPackable>
<GenerateProgramFile>false</GenerateProgramFile>
<WarningsAsErrors>FS0025</WarningsAsErrors>
<AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>
</PropertyGroup>

<ItemGroup>
<None Include="paket.references" />
<Compile Include="DomainTests.fs" />
<Compile Include="AppTests.fs" />
<Compile Include="ConsoleTests.fs" />
<Compile Include="Program.fs" />
</ItemGroup>

<ItemGroup>
<PackageReference Include="FsCheck.Xunit" Version="2.16.5" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.6.0" />
<PackageReference Include="Unquote" Version="6.1.0" />
<PackageReference Include="xunit" Version="2.4.2" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.5">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
<PackageReference Include="coverlet.collector" Version="6.0.0">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\extLauncher\extLauncher.fsproj" />
</ItemGroup>

</Project>
<Import Project="..\.paket\Paket.Restore.targets" />
</Project>
6 changes: 6 additions & 0 deletions extLauncher.Tests/paket.references
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
FsCheck.Xunit
Microsoft.NET.Test.Sdk
Unquote
xunit
xunit.runner.visualstudio
coverlet.collector
5 changes: 1 addition & 4 deletions extLauncher/App.fs
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,7 @@ let refresh loadFiles save (folder: Folder) : Folder option =
newFiles
|> Array.map (fun newFile ->
match currentFiles.TryFind newFile.Path with
| Some current -> {
newFile with
Triggered = current.Triggered
}
| Some current -> { newFile with Triggered = current.Triggered }
| None -> newFile
)
|> fun files -> { folder with Files = files }
Expand Down
Loading

0 comments on commit 8261d43

Please sign in to comment.