Add two (currently failing) tests.
authorMikhail Glushenkov <foldr@codedgers.com>
Tue, 6 May 2008 18:11:21 +0000 (18:11 +0000)
committerMikhail Glushenkov <foldr@codedgers.com>
Tue, 6 May 2008 18:11:21 +0000 (18:11 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@50752 91177308-0d34-0410-b5e6-96231b3b80d8

test/LLVMC/false.c [new file with mode: 0644]
test/LLVMC/false.cpp [new file with mode: 0644]
test/LLVMC/false2.cpp [new file with mode: 0644]
test/LLVMC/hello.cpp [new file with mode: 0644]

diff --git a/test/LLVMC/false.c b/test/LLVMC/false.c
new file mode 100644 (file)
index 0000000..80e9e03
--- /dev/null
@@ -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 <iostream>
+
+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 (file)
index 0000000..d3a7102
--- /dev/null
@@ -0,0 +1,17 @@
+/* RUN: ignore */
+#include <stdio.h>
+
+/* 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 (file)
index 0000000..a020514
--- /dev/null
@@ -0,0 +1,6 @@
+// RUN: ignore
+#include <string>
+
+std::string test2() {
+    return "lo";
+}
diff --git a/test/LLVMC/hello.cpp b/test/LLVMC/hello.cpp
new file mode 100644 (file)
index 0000000..a3148c3
--- /dev/null
@@ -0,0 +1,8 @@
+// Test that we can compile C++ code.
+// RUN: llvmc2 %s -o %t
+// RUN: ./%t | grep hello
+#include <iostream>
+
+int main() {
+    std::cout << "hello" << '\n';
+}