Skip to content

Commit

Permalink
Improve tests & update version to 1.3.1 (#166)
Browse files Browse the repository at this point in the history
- Tests now ignore the version change (to avoid regenerating a bunch of golden files)
- Fix shader compilation warning (int vs float)
  • Loading branch information
laurentlb authored Nov 12, 2022
1 parent 2273d84 commit 1d87675
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 5 deletions.
9 changes: 8 additions & 1 deletion Checker/main.fs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ open System.Diagnostics
open System.IO

open Argu
open System.Text.RegularExpressions

type CliArguments =
| Update_Golden
Expand Down Expand Up @@ -74,8 +75,14 @@ let testPerformance files =
let time = stopwatch.Elapsed
printfn "%i files minified in %f seconds." files.Length time.TotalSeconds

// Generated files may contain the Shader Minifier version.
// Ignore version changes in the tests.
let versionRegex = new Regex(@"\bShader Minifier \d(\.\d+)+");

let runCommand argv =
let cleanString (s: string) = s.Replace("\r\n", "\n").Trim()
let cleanString (s: string) =
let s = s.Replace("\r\n", "\n").Trim()
versionRegex.Replace(s, "")
Options.init argv
let expected =
try File.ReadAllText options.outputName |> cleanString
Expand Down
2 changes: 1 addition & 1 deletion src/options.fs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
open System.IO
open Argu

let version = "1.3" // Shader Minifier version
let version = "1.3.1" // Shader Minifier version
let debugMode = false

type OutputFormat =
Expand Down
2 changes: 1 addition & 1 deletion tests/unit/inline-aggro.aggro.expected
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ int noinl11(ivec3 x)
x[i++]+=1;
return x[i]+i;
}
float noinl12()
int noinl12()
{
int i=10;
while(--i>0)
Expand Down
2 changes: 1 addition & 1 deletion tests/unit/inline-aggro.expected
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ int noinl11(ivec3 x)
x[i++]+=1;
return x[i]+i;
}
float noinl12()
int noinl12()
{
int i=10;
while(--i>0)
Expand Down
2 changes: 1 addition & 1 deletion tests/unit/inline-aggro.frag
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ int noinl11(in ivec3 x) {
return x[i] + i;
}

float noinl12() {
int noinl12() {
int i = 10;
while (--i > 0) {
}
Expand Down

0 comments on commit 1d87675

Please sign in to comment.