From 1d8767549eb5a266e203d4d77e6b6fcc0e0122af Mon Sep 17 00:00:00 2001 From: Laurent Le Brun Date: Sat, 12 Nov 2022 21:02:39 +0100 Subject: [PATCH] Improve tests & update version to 1.3.1 (#166) - Tests now ignore the version change (to avoid regenerating a bunch of golden files) - Fix shader compilation warning (int vs float) --- Checker/main.fs | 9 ++++++++- src/options.fs | 2 +- tests/unit/inline-aggro.aggro.expected | 2 +- tests/unit/inline-aggro.expected | 2 +- tests/unit/inline-aggro.frag | 2 +- 5 files changed, 12 insertions(+), 5 deletions(-) diff --git a/Checker/main.fs b/Checker/main.fs index b28ee249..3541d360 100644 --- a/Checker/main.fs +++ b/Checker/main.fs @@ -5,6 +5,7 @@ open System.Diagnostics open System.IO open Argu +open System.Text.RegularExpressions type CliArguments = | Update_Golden @@ -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 diff --git a/src/options.fs b/src/options.fs index 5d616ab4..cae4e1b5 100644 --- a/src/options.fs +++ b/src/options.fs @@ -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 = diff --git a/tests/unit/inline-aggro.aggro.expected b/tests/unit/inline-aggro.aggro.expected index 1930c5e2..b2dafc44 100644 --- a/tests/unit/inline-aggro.aggro.expected +++ b/tests/unit/inline-aggro.aggro.expected @@ -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) diff --git a/tests/unit/inline-aggro.expected b/tests/unit/inline-aggro.expected index 258ed377..e75bc1d9 100644 --- a/tests/unit/inline-aggro.expected +++ b/tests/unit/inline-aggro.expected @@ -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) diff --git a/tests/unit/inline-aggro.frag b/tests/unit/inline-aggro.frag index a0fdcce5..00c8eae2 100644 --- a/tests/unit/inline-aggro.frag +++ b/tests/unit/inline-aggro.frag @@ -119,7 +119,7 @@ int noinl11(in ivec3 x) { return x[i] + i; } -float noinl12() { +int noinl12() { int i = 10; while (--i > 0) { }