From ceda1734cc33f14077cf48ee1cbe020532a89c81 Mon Sep 17 00:00:00 2001 From: Mikhail Glushenkov Date: Tue, 6 May 2008 18:11:21 +0000 Subject: [PATCH] Add two (currently failing) tests. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@50752 91177308-0d34-0410-b5e6-96231b3b80d8 --- test/LLVMC/false.c | 14 ++++++++++++++ test/LLVMC/false.cpp | 17 +++++++++++++++++ test/LLVMC/false2.cpp | 6 ++++++ test/LLVMC/hello.cpp | 8 ++++++++ 4 files changed, 45 insertions(+) create mode 100644 test/LLVMC/false.c create mode 100644 test/LLVMC/false.cpp create mode 100644 test/LLVMC/false2.cpp create mode 100644 test/LLVMC/hello.cpp diff --git a/test/LLVMC/false.c b/test/LLVMC/false.c new file mode 100644 index 00000000000..80e9e03b543 --- /dev/null +++ b/test/LLVMC/false.c @@ -0,0 +1,14 @@ +// Test that we can compile .c files as C++ and vice versa +// RUN: llvmc2 -x c++ %s -x c %p/false.cpp -x lisp -x whatnot -x none %p/false2.cpp -o %t +// RUN: ./%t | grep hello + +#include + +extern "C" void test(); +extern std::string test2(); + +int main() { + std::cout << "h"; + test(); + std::cout << test2() << '\n'; +} diff --git a/test/LLVMC/false.cpp b/test/LLVMC/false.cpp new file mode 100644 index 00000000000..d3a7102f8cc --- /dev/null +++ b/test/LLVMC/false.cpp @@ -0,0 +1,17 @@ +/* RUN: ignore */ +#include + +/* Make this invalid C++ */ +typedef struct { + int i; + char c; +} a; + +static a b = { .i = 65, .c = 'r'}; + +void test() { + b.i = 9; + fflush(stdout); + printf("el"); +} + diff --git a/test/LLVMC/false2.cpp b/test/LLVMC/false2.cpp new file mode 100644 index 00000000000..a02051415dd --- /dev/null +++ b/test/LLVMC/false2.cpp @@ -0,0 +1,6 @@ +// RUN: ignore +#include + +std::string test2() { + return "lo"; +} diff --git a/test/LLVMC/hello.cpp b/test/LLVMC/hello.cpp new file mode 100644 index 00000000000..a3148c3c164 --- /dev/null +++ b/test/LLVMC/hello.cpp @@ -0,0 +1,8 @@ +// Test that we can compile C++ code. +// RUN: llvmc2 %s -o %t +// RUN: ./%t | grep hello +#include + +int main() { + std::cout << "hello" << '\n'; +}