[libcxx-commits] [libcxx] 86d6136 - [libc++] More consistency with declaring int main(int, char**)
Louis Dionne via libcxx-commits
libcxx-commits at lists.llvm.org
Fri Oct 9 07:10:04 PDT 2020
Author: Louis Dionne
Date: 2020-10-09T10:09:57-04:00
New Revision: 86d61365d8cfae8afdb4deb90b21709ddd482b20
URL: https://github.com/llvm/llvm-project/commit/86d61365d8cfae8afdb4deb90b21709ddd482b20
DIFF: https://github.com/llvm/llvm-project/commit/86d61365d8cfae8afdb4deb90b21709ddd482b20.diff
LOG: [libc++] More consistency with declaring int main(int, char**)
Added:
Modified:
libcxx/test/libcxx/selftest/dsl/dsl.sh.py
Removed:
################################################################################
diff --git a/libcxx/test/libcxx/selftest/dsl/dsl.sh.py b/libcxx/test/libcxx/selftest/dsl/dsl.sh.py
index 7086c69cdd11..3c90ebe63d91 100644
--- a/libcxx/test/libcxx/selftest/dsl/dsl.sh.py
+++ b/libcxx/test/libcxx/selftest/dsl/dsl.sh.py
@@ -107,18 +107,19 @@ class TestSourceBuilds(SetupConfigs):
Tests for libcxx.test.dsl.sourceBuilds
"""
def test_valid_program_builds(self):
- source = """int main(int, char**) { }"""
+ source = """int main(int, char**) { return 0; }"""
self.assertTrue(dsl.sourceBuilds(self.config, source))
def test_compilation_error_fails(self):
- source = """in main(int, char**) { }"""
+ source = """int main(int, char**) { this does not compile }"""
self.assertFalse(dsl.sourceBuilds(self.config, source))
def test_link_error_fails(self):
source = """extern void this_isnt_defined_anywhere();
- int main(int, char**) { this_isnt_defined_anywhere(); }"""
+ int main(int, char**) { this_isnt_defined_anywhere(); return 0; }"""
self.assertFalse(dsl.sourceBuilds(self.config, source))
+
class TestProgramOutput(SetupConfigs):
"""
Tests for libcxx.test.dsl.programOutput
@@ -126,20 +127,20 @@ class TestProgramOutput(SetupConfigs):
def test_valid_program_returns_output(self):
source = """
#include <cstdio>
- int main(int, char**) { std::printf("FOOBAR"); }
+ int main(int, char**) { std::printf("FOOBAR"); return 0; }
"""
self.assertEqual(dsl.programOutput(self.config, source), "FOOBAR")
def test_valid_program_returns_output_newline_handling(self):
source = """
#include <cstdio>
- int main(int, char**) { std::printf("FOOBAR\\n"); }
+ int main(int, char**) { std::printf("FOOBAR\\n"); return 0; }
"""
self.assertEqual(dsl.programOutput(self.config, source), "FOOBAR\n")
def test_valid_program_returns_no_output(self):
source = """
- int main(int, char**) { }
+ int main(int, char**) { return 0; }
"""
self.assertEqual(dsl.programOutput(self.config, source), "")
@@ -165,6 +166,7 @@ def test_pass_arguments_to_program(self):
assert(argc == 3);
assert(argv[1] == std::string("first-argument"));
assert(argv[2] == std::string("second-argument"));
+ return 0;
}
"""
args = ["first-argument", "second-argument"]
More information about the libcxx-commits
mailing list