Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions tests/service/SyntaxTreeTests.fs
Original file line number Diff line number Diff line change
Expand Up @@ -176,17 +176,24 @@ let ParseFile fileName =
$"%A{ast}\n\n%s{diagnostics}"
|> normalize
|> sprintf "%s\n"

let bslPath = $"{fullPath}.bsl"
let actualPath = $"{fullPath}.actual"

let expected =
if File.Exists bslPath then
File.ReadAllText bslPath |> normalize
else
"No baseline was found"

let equals = expected = actual
let testUpdateBSLEnv = System.Environment.GetEnvironmentVariable("TEST_UPDATE_BSL")

if not (isNull testUpdateBSLEnv) && testUpdateBSLEnv.Trim() = "1" then
File.WriteAllText(bslPath, actual)
elif not equals then
File.WriteAllText(actualPath, actual)
else
File.Delete(actualPath)

Assert.AreEqual(expected, actual)
1 change: 1 addition & 0 deletions tests/service/data/SyntaxTree/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
*.actual