xref: /llvm-project/lldb/test/Shell/Commands/command-expr-diagnostics.test (revision 20c4e95b9c03a77c2e5ce5f354114752d380c591)
1# XFAIL: target-windows
2# RUN: echo quit | %lldb -o "expression a+b" \
3# RUN:   | FileCheck %s --strict-whitespace --check-prefix=CHECK1
4#            (lldb) expression a+b
5# CHECK1:{{^                  \^ \^}}
6# CHECK1: {{^                  | error: use of undeclared identifier 'b'}}
7# CHECK1: {{^                  error: use of undeclared identifier 'a'}}
8
9# RUN: echo quit | %lldb -o "expr a" \
10# RUN:   | FileCheck %s --strict-whitespace --check-prefix=CHECK2
11#            (lldb) expr a
12# CHECK2:{{^            \^}}
13
14# RUN: echo quit | %lldb -o "expr -i 0 -o 0 -- a" \
15# RUN:   | FileCheck %s --strict-whitespace --check-prefix=CHECK3
16#            (lldb) expr -i 0 -o 0 -- a
17# CHECK3:{{^                         \^}}
18# CHECK3: {{^                         error: use of undeclared identifier 'a'}}
19
20# RUN: echo "int main(){return 0;}">%t.c
21# RUN: %clang_host %t.c -o %t.exe
22# RUN: echo quit | %lldb %t.exe -o "b main" -o r -o \
23# RUN: "expr --top-level -- template<typename T> T FOO(T x) { return x/2;}" -o \
24# RUN: "expression -- FOO(\"\")" 2>&1 | FileCheck %s --check-prefix=CHECK4
25#            (lldb) expression -- FOO("")
26# CHECK4:{{^                     \^}}
27# CHECK4: {{^                     note: in instantiation of function template}}
28# CHECK4: error: <user expression
29
30# RUN: echo expression --\na\n+\nb
31# RUN: cat %S/Inputs/multiline-expr.txt | %lldb 2>&1 | FileCheck %s --strict-whitespace --check-prefix=CHECK5
32# CHECK5: error: <user{{.*}}a
33# CHECK5: error: <user{{.*}}b
34