Skip to content

unittests: Use EXPECT_ instead of ASSERT_ in a few tests #129251

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged

Conversation

arsenm
Copy link
Contributor

@arsenm arsenm commented Feb 28, 2025

No description provided.

@arsenm arsenm added llvm-tools All llvm tools that do not have corresponding tag test-suite labels Feb 28, 2025 — with Graphite App
Copy link
Contributor Author

arsenm commented Feb 28, 2025

@arsenm arsenm marked this pull request as ready for review February 28, 2025 14:21
@llvmbot
Copy link
Member

llvmbot commented Feb 28, 2025

@llvm/pr-subscribers-llvm-support

Author: Matt Arsenault (arsenm)

Changes

Full diff: https://github.com/llvm/llvm-project/pull/129251.diff

1 Files Affected:

  • (modified) llvm/unittests/Support/ProgramTest.cpp (+6-6)
diff --git a/llvm/unittests/Support/ProgramTest.cpp b/llvm/unittests/Support/ProgramTest.cpp
index b1b35eacd1f61..47d2e269afe94 100644
--- a/llvm/unittests/Support/ProgramTest.cpp
+++ b/llvm/unittests/Support/ProgramTest.cpp
@@ -422,10 +422,10 @@ TEST(ProgramTest, TestExecuteNegative) {
     bool ExecutionFailed;
     int RetCode = ExecuteAndWait(Executable, argv, std::nullopt, {}, 0, 0,
                                  &Error, &ExecutionFailed);
-    ASSERT_LT(RetCode, 0) << "On error ExecuteAndWait should return 0 or "
+    EXPECT_LT(RetCode, 0) << "On error ExecuteAndWait should return 0 or "
                              "positive value indicating the result code";
-    ASSERT_TRUE(ExecutionFailed);
-    ASSERT_FALSE(Error.empty());
+    EXPECT_TRUE(ExecutionFailed);
+    EXPECT_FALSE(Error.empty());
   }
 
   {
@@ -433,10 +433,10 @@ TEST(ProgramTest, TestExecuteNegative) {
     bool ExecutionFailed;
     ProcessInfo PI = ExecuteNoWait(Executable, argv, std::nullopt, {}, 0,
                                    &Error, &ExecutionFailed);
-    ASSERT_EQ(PI.Pid, ProcessInfo::InvalidPid)
+    EXPECT_EQ(PI.Pid, ProcessInfo::InvalidPid)
         << "On error ExecuteNoWait should return an invalid ProcessInfo";
-    ASSERT_TRUE(ExecutionFailed);
-    ASSERT_FALSE(Error.empty());
+    EXPECT_TRUE(ExecutionFailed);
+    EXPECT_FALSE(Error.empty());
   }
 
 }

Copy link
Contributor Author

arsenm commented Mar 2, 2025

Merge activity

  • Mar 1, 9:21 PM EST: A user started a stack merge that includes this pull request via Graphite.
  • Mar 1, 9:27 PM EST: Graphite rebased this pull request as part of a merge.
  • Mar 1, 9:29 PM EST: A user merged this pull request with Graphite.

@arsenm arsenm force-pushed the users/arsenm/issue129208/llvm-rc-relax-test-error-message branch from d336a1f to aca6e94 Compare March 2, 2025 02:23
Base automatically changed from users/arsenm/issue129208/llvm-rc-relax-test-error-message to main March 2, 2025 02:26
@arsenm arsenm force-pushed the users/arsenm/support/gtest-use-expect-instead-of-assert branch from 47533d0 to bc18c29 Compare March 2, 2025 02:27
@arsenm arsenm merged commit a0540e6 into main Mar 2, 2025
6 of 11 checks passed
@arsenm arsenm deleted the users/arsenm/support/gtest-use-expect-instead-of-assert branch March 2, 2025 02:29
jph-13 pushed a commit to jph-13/llvm-project that referenced this pull request Mar 21, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
llvm:support llvm-tools All llvm tools that do not have corresponding tag test-suite
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants