Skip to content

Commit a011cba

Browse files
committed
Simplify whether a header is present.
This use the status used for the Standard library modules.
1 parent da82709 commit a011cba

12 files changed

+62
-96
lines changed

libcxx/test/libcxx/feature_test_macro/ftm_metadata.sh.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121

2222
class Test(unittest.TestCase):
2323
def setUp(self):
24-
self.ftm = FeatureTestMacros(TEST_DATA)
24+
self.ftm = FeatureTestMacros(TEST_DATA, ["charconv"])
2525
self.maxDiff = None # This causes the diff to be printed when the test fails
2626

2727
def test_implementation(self):

libcxx/test/libcxx/feature_test_macro/generate_header_test.sh.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323

2424
class Test(unittest.TestCase):
2525
def setUp(self):
26-
self.ftm = FeatureTestMacros(TEST_DATA)
26+
self.ftm = FeatureTestMacros(TEST_DATA, ["charconv"])
2727
self.maxDiff = None # This causes the diff to be printed when the test fails
2828

2929
self.expected = dict(
@@ -299,7 +299,7 @@ def setUp(self):
299299
300300
// clang-format off
301301
302-
#if __has_include(<charconv>)
302+
#if !defined(_WIN32) && __has_include(<charconv>)
303303
# include <charconv>
304304
#endif
305305
#include "test_macros.h"

libcxx/test/libcxx/feature_test_macro/implemented_ftms.sh.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121

2222
class Test(unittest.TestCase):
2323
def setUp(self):
24-
self.ftm = FeatureTestMacros(TEST_DATA)
24+
self.ftm = FeatureTestMacros(TEST_DATA, ["charconv"])
2525
self.maxDiff = None # This causes the diff to be printed when the test fails
2626

2727
def test_implementation(self):

libcxx/test/libcxx/feature_test_macro/implemented_standard_library_headers.sh.py

Lines changed: 0 additions & 32 deletions
This file was deleted.

libcxx/test/libcxx/feature_test_macro/invalid.sh.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ def test_error(data, type, message):
2323
tmp = sys.argv[2]
2424
with open(tmp, "w") as file:
2525
file.write(json.dumps(data))
26-
ftm = FeatureTestMacros(tmp)
26+
ftm = FeatureTestMacros(tmp, ["charconv"])
2727
try:
2828
ftm.implemented_ftms
2929
except type as error:

libcxx/test/libcxx/feature_test_macro/is_implemented.sh.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121

2222
class Test(unittest.TestCase):
2323
def setUp(self):
24-
self.ftm = FeatureTestMacros(TEST_DATA)
24+
self.ftm = FeatureTestMacros(TEST_DATA, ["charconv"])
2525
self.maxDiff = None # This causes the diff to be printed when the test fails
2626

2727
def test_implementation(self):

libcxx/test/libcxx/feature_test_macro/standard_ftms.sh.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121

2222
class Test(unittest.TestCase):
2323
def setUp(self):
24-
self.ftm = FeatureTestMacros(TEST_DATA)
24+
self.ftm = FeatureTestMacros(TEST_DATA, ["charconv"])
2525
self.maxDiff = None # This causes the diff to be printed when the test fails
2626

2727
def test_implementation(self):

libcxx/test/libcxx/feature_test_macro/standard_library_headers.sh.py

Lines changed: 32 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -10,24 +10,35 @@
1010

1111
import sys
1212

13-
sys.path.append(sys.argv[1])
14-
from generate_feature_test_macro_components import FeatureTestMacros
15-
16-
17-
def test(output, expected):
18-
assert output == expected, f"expected\n{expected}\n\noutput\n{output}"
19-
20-
21-
ftm = FeatureTestMacros(sys.argv[2])
22-
test(
23-
sorted(ftm.standard_library_headers),
24-
[
25-
"algorithm",
26-
"any",
27-
"barrier",
28-
"charconv",
29-
"format",
30-
"numeric",
31-
"variant",
32-
],
33-
)
13+
import unittest
14+
15+
UTILS = sys.argv[1]
16+
TEST_DATA = sys.argv[2]
17+
del sys.argv[1:3]
18+
19+
sys.path.append(UTILS)
20+
from generate_feature_test_macro_components import FeatureTestMacros, Metadata
21+
22+
23+
class Test(unittest.TestCase):
24+
def setUp(self):
25+
self.ftm = FeatureTestMacros(TEST_DATA, ["charconv"])
26+
self.maxDiff = None # This causes the diff to be printed when the test fails
27+
28+
def test_implementation(self):
29+
self.assertEqual(
30+
sorted(self.ftm.standard_library_headers),
31+
[
32+
"algorithm",
33+
"any",
34+
"barrier",
35+
"charconv",
36+
"format",
37+
"numeric",
38+
"variant",
39+
],
40+
)
41+
42+
43+
if __name__ == "__main__":
44+
unittest.main()

libcxx/test/libcxx/feature_test_macro/std_dialects.sh.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121

2222
class Test(unittest.TestCase):
2323
def setUp(self):
24-
self.ftm = FeatureTestMacros(TEST_DATA)
24+
self.ftm = FeatureTestMacros(TEST_DATA, ["charconv"])
2525
self.maxDiff = None # This causes the diff to be printed when the test fails
2626

2727
def test_implementation(self):

libcxx/test/libcxx/feature_test_macro/version_header.sh.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121

2222
class Test(unittest.TestCase):
2323
def setUp(self):
24-
self.ftm = FeatureTestMacros(TEST_DATA)
24+
self.ftm = FeatureTestMacros(TEST_DATA, ["charconv"])
2525
self.maxDiff = None # This causes the diff to be printed when the test fails
2626

2727
def test_implementeation(self):

0 commit comments

Comments
 (0)