Add error recovery and unloading tests.

This commit is contained in:
Vassil Vassilev 2013-12-03 15:35:13 +01:00 committed by sftnight
parent 51d27bf1e5
commit b41a282ae6
6 changed files with 52 additions and 0 deletions

View File

@ -0,0 +1,6 @@
#ifndef PROTECTED_TRIVIAL_CLASS
#define PROTECTED_TRIVIAL_CLASS
class Trivial {
};
#endif // PROTECTED_TRIVIAL_CLASS

View File

@ -0,0 +1,6 @@
// RUN: cat %s | %cling -I%p
.storeState "a"
#include "ProtectedClass.h"
.U
.compareState "a"
// CHECK-NOT: Differences

View File

@ -0,0 +1,5 @@
// RUN: cat %s | %cling -I%p -Xclang -verify 2>&1
.storeState "a"
#include "HeaderFileProtector.h"
.compareState "a"
// CHECK-NOT: Differences

View File

@ -0,0 +1,11 @@
#ifndef HEADER_FILE_PROTECTOR
#define HEADER_FILE_PROTECTOR
#define NN 5
#undef NN
#define NN 6
#define P 5
class MyHeaderFileProtectedClass {};
#undef P
error_here; // expected-error {{C++ requires a type specifier for all declarations}}
#endif // HEADER_FILE_PROTECTOR

View File

@ -0,0 +1,16 @@
// RUN: cat %s | %cling -I%p -Xclang -verify 2>&1
.rawInput 1
extern "C" int printf(const char* fmt, ...);
#define NN 5
int printNN() {
printf("NN=%d", NN);
return 0;
}
.rawInput 0
printNN();
.storeState "MacroDef"
#include "MacroDef.h"
.compareState "MacroDef"
// CHECK-NOT: Differences
printNN();

View File

@ -0,0 +1,8 @@
#ifndef HEADER_FILE_PROTECTOR
#define HEADER_FILE_PROTECTOR
int f() {
return NN+1;
}
int n = f();
error_here; // expected-error {{C++ requires a type specifier for all declarations}}
#endif // HEADER_FILE_PROTECTOR