[libc++] Move some .sh.cpp tests to .compile.pass.cpp
authorLouis Dionne <ldionne@apple.com>
Wed, 15 Apr 2020 16:08:05 +0000 (12:08 -0400)
committerLouis Dionne <ldionne@apple.com>
Wed, 15 Apr 2020 16:27:49 +0000 (12:27 -0400)
As a fly-by fix, improve/fix the comments explaining the tests. This is
a step towards removing references to the %{compile} substitution.

libcxx/test/libcxx/depr/depr.c.headers/math_h.compile.pass.cpp [moved from libcxx/test/libcxx/depr/depr.c.headers/math_h.sh.cpp with 51% similarity]
libcxx/test/libcxx/min_max_macros.compile.pass.cpp [moved from libcxx/test/libcxx/min_max_macros.sh.cpp with 97% similarity]
libcxx/test/libcxx/no_assert_include.compile.pass.cpp [moved from libcxx/test/libcxx/no_assert_include.sh.cpp with 99% similarity]

@@ -6,17 +6,23 @@
 //
 //===----------------------------------------------------------------------===//
 
-// RUN: %{compile} -fsyntax-only
+// Code on Windows expects to be able to do:
+//
+//  #define _USE_MATH_DEFINES
+//  #include <math.h>
+//
+// and receive the definitions of mathematical constants, even if <math.h>
+// has previously been included. Make sure that works.
+//
 
 #ifdef _MSC_VER
+#   include <math.h>
+#   define _USE_MATH_DEFINES
+#   include <math.h>
 
-#include <math.h>
-
-#define _USE_MATH_DEFINES
-#include <math.h>
-
-#ifndef M_PI
-#error M_PI not defined
+#   ifndef M_PI
+#       error M_PI not defined
+#   endif
 #endif
 
-#endif
+int main() { }
@@ -7,9 +7,8 @@
 //
 //===----------------------------------------------------------------------===//
 
-// Test that we can include each header in two TU's and link them together.
-
-// RUN: %{compile} -fsyntax-only
+// Test that headers are not tripped up by the surrounding code defining the
+// min() and max() macros.
 
 // Prevent <ext/hash_map> from generating deprecated warnings for this test.
 #if defined(__DEPRECATED)
@@ -283,3 +282,5 @@ TEST_MACROS();
 TEST_MACROS();
 #include <ext/hash_set>
 TEST_MACROS();
+
+int main() { }
@@ -10,8 +10,6 @@
 // Ensure that none of the standard C++ headers implicitly include cassert or
 // assert.h (because assert() is implemented as a macro).
 
-// RUN: %{compile} -fsyntax-only
-
 // Prevent <ext/hash_map> from generating deprecated warnings for this test.
 #if defined(__DEPRECATED)
 #undef __DEPRECATED
 #ifdef assert
 #error "Do not include cassert or assert.h in standard header files"
 #endif
+
+int main() { }