From 7f417b08cf87b240b19c9845c20fac688ac00fd7 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. llvm-svn: 50752 --- llvm/test/LLVMC/false.c | 14 ++++++++++++++ llvm/test/LLVMC/false.cpp | 17 +++++++++++++++++ llvm/test/LLVMC/false2.cpp | 6 ++++++ llvm/test/LLVMC/hello.cpp | 8 ++++++++ 4 files changed, 45 insertions(+) create mode 100644 llvm/test/LLVMC/false.c create mode 100644 llvm/test/LLVMC/false.cpp create mode 100644 llvm/test/LLVMC/false2.cpp create mode 100644 llvm/test/LLVMC/hello.cpp diff --git a/llvm/test/LLVMC/false.c b/llvm/test/LLVMC/false.c new file mode 100644 index 000000000000..80e9e03b5436 --- /dev/null +++ b/llvm/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/llvm/test/LLVMC/false.cpp b/llvm/test/LLVMC/false.cpp new file mode 100644 index 000000000000..d3a7102f8cca --- /dev/null +++ b/llvm/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/llvm/test/LLVMC/false2.cpp b/llvm/test/LLVMC/false2.cpp new file mode 100644 index 000000000000..a02051415ddd --- /dev/null +++ b/llvm/test/LLVMC/false2.cpp @@ -0,0 +1,6 @@ +// RUN: ignore +#include + +std::string test2() { + return "lo"; +} diff --git a/llvm/test/LLVMC/hello.cpp b/llvm/test/LLVMC/hello.cpp new file mode 100644 index 000000000000..a3148c3c164f --- /dev/null +++ b/llvm/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'; +}