Skip to content

Commit 6a44506

Browse files
committed
Fix tests, make them more generic
1 parent 7c6b54c commit 6a44506

File tree

6 files changed

+708
-367
lines changed

6 files changed

+708
-367
lines changed

tests/ParallelTypeCheckingTests/ComponentTests_args.txt

Lines changed: 236 additions & 191 deletions
Large diffs are not rendered by default.

tests/ParallelTypeCheckingTests/Program.fs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,4 +29,12 @@ let _parse (argv: string[]): Args =
2929

3030
[<EntryPoint>]
3131
let main _argv =
32+
let workDir, path = CompilationFromArgsTests.codebases[0]
33+
let stuff =
34+
{
35+
Path = path
36+
WorkingDir = Some workDir
37+
Mode = Method.ParallelFs
38+
}
39+
CompilationFromArgsTests.TestCompilerFromArgs stuff
3240
0

tests/ParallelTypeCheckingTests/Tests/CompilationFromArgsTests.fs

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,14 @@ open FSharp.Compiler.Service.Tests
77
open NUnit.Framework
88
open Utils
99

10+
let codebases =
11+
[
12+
@"$CODE_ROOT$\tests\FSharp.Compiler.ComponentTests", @"$CODE_ROOT$\tests\ParallelTypeCheckingTests\ComponentTests_args.txt"
13+
@"$CODE_ROOT$\src\compiler", @"$CODE_ROOT$\tests\ParallelTypeCheckingTests\Tests\FCSArgs.txt"
14+
]
15+
1016
let configs =
11-
let codebases =
12-
[
13-
@"C:\projekty\fsharp\heuristic\tests\FSharp.Compiler.ComponentTests", @"C:\projekty\fsharp\heuristic\tests\ParallelTypeCheckingTests\ComponentTests_args.txt"
14-
@"C:\projekty\fsharp\fsharp_main\src\compiler", @"C:\projekty\fsharp\heuristic\tests\ParallelTypeCheckingTests\Tests\FCSArgs.txt"
15-
]
17+
1618

1719
methods
1820
|> List.allPairs codebases
@@ -43,17 +45,21 @@ let setupArgsMethod (method: Method) (args: string[]): string[] =
4345

4446
let setupParsed config =
4547
let {Path = path; Mode = mode; WorkingDir = workingDir} = config
46-
let args = System.IO.File.ReadAllLines(path)
48+
let args =
49+
System.IO.File.ReadAllLines(path |> replacePaths)
50+
|> Array.map replacePaths
51+
4752
printfn $"WorkingDir = {workingDir}"
53+
printfn $"%+A{args}"
4854
let args = setupArgsMethod mode args
49-
workingDir |> Option.iter (fun dir -> Environment.CurrentDirectory <- dir)
55+
workingDir |> Option.iter (fun dir -> Environment.CurrentDirectory <- replaceCodeRoot dir)
5056
args
5157

5258
[<TestCaseSource(nameof(configs))>]
5359
let TestCompilerFromArgs (config : Args) : unit =
5460
let oldWorkDir = Environment.CurrentDirectory
5561
try
56-
let args = setupParsed config
62+
let args = setupParsed config
5763
let exit = CommandLineMain.main args
5864
Assert.That(exit, Is.Zero)
5965
finally

0 commit comments

Comments
 (0)