From fcdddfd1aa6570e9ecfdcf554452f7a68c8f800a Mon Sep 17 00:00:00 2001 From: Adriano Carlos Verona Date: Tue, 22 Oct 2024 17:39:17 -0400 Subject: [PATCH] it cant't be so hard, or can it? --- .github/workflows/cecilifier-ci-alltests.yml | 4 ++-- .github/workflows/cecilifier-ci-onpush.yml | 3 ++- .github/workflows/run_tests_base.yml | 2 +- .../Tests/Unit/ForEachStatementTests.cs | 9 ++++----- 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/.github/workflows/cecilifier-ci-alltests.yml b/.github/workflows/cecilifier-ci-alltests.yml index f4b24768..14bd152e 100644 --- a/.github/workflows/cecilifier-ci-alltests.yml +++ b/.github/workflows/cecilifier-ci-alltests.yml @@ -1,5 +1,5 @@ name: Run Tests -run-name: Verifying ${{ github.ref }} 🚀 +run-name: Verifying ${{ github.ref }} (push to test-env branch) 🚀 on: push: branches: @@ -8,4 +8,4 @@ jobs: RunTests: uses: ./.github/workflows/run_tests_base.yml with: - run-outputbased-tests: true \ No newline at end of file + run_outputbased_tests: true \ No newline at end of file diff --git a/.github/workflows/cecilifier-ci-onpush.yml b/.github/workflows/cecilifier-ci-onpush.yml index b4845fda..55fef508 100644 --- a/.github/workflows/cecilifier-ci-onpush.yml +++ b/.github/workflows/cecilifier-ci-onpush.yml @@ -1,6 +1,7 @@ name: Run Tests -run-name: Verifying ${{ github.ref }} 🚀 +run-name: Verifying ${{ github.ref }} (push, any branch but test-env) 🚀 on: [push] jobs: RunTests: + if: github.ref != 'refs/heads/test-env' uses: ./.github/workflows/run_tests_base.yml diff --git a/.github/workflows/run_tests_base.yml b/.github/workflows/run_tests_base.yml index bc16bb01..0d683ef4 100644 --- a/.github/workflows/run_tests_base.yml +++ b/.github/workflows/run_tests_base.yml @@ -3,7 +3,7 @@ run-name: Verifying ${{ github.ref }} 🚀 on: workflow_call: inputs: - run-outputbased-tests: + run_outputbased_tests: required: false type: boolean jobs: diff --git a/Cecilifier.Core.Tests/Tests/Unit/ForEachStatementTests.cs b/Cecilifier.Core.Tests/Tests/Unit/ForEachStatementTests.cs index 845ce59a..7a86bf4d 100644 --- a/Cecilifier.Core.Tests/Tests/Unit/ForEachStatementTests.cs +++ b/Cecilifier.Core.Tests/Tests/Unit/ForEachStatementTests.cs @@ -19,10 +19,9 @@ class CecilifierTestContext : IDisposable public void Dispose() { var testMethod = TestContext.CurrentContext.Test.Method?.MethodInfo; - var shouldRun = (Environment.GetEnvironmentVariable("CECILIFIER_TESTS_VERIFY_OUTPUT") - ?? SingleOrDefault(testMethod)?.Constructor.Name - ?? SingleOrDefault(testMethod?.DeclaringType)?.Constructor.Name - ) != null; + var shouldRun = Environment.GetEnvironmentVariable("CECILIFIER_TESTS_VERIFY_OUTPUT") == "true" + || SingleOrDefault(testMethod)?.Constructor.Name != null + || SingleOrDefault(testMethod?.DeclaringType)?.Constructor.Name != null; if (shouldRun) { @@ -41,7 +40,7 @@ CustomAttributeData SingleOrDefault(MemberInfo? member) public void Foo() { using var x = new CecilifierTestContext(); - Assert.That(1, Is.EqualTo(2)); + Assert.That(1, Is.EqualTo(1)); // // Arrange // using var testContext = ContextFor( // "foreach(var i in M()) { Console.Write(i); } int[] M() => {1, 2, 3};",