blob: 6abf40df36c1e68f7ece745aa0228d91cb687296 [file] [log] [blame]
Sam McCallbb2cf632018-01-12 14:51:47 +00001namespace ns {
2int bar;
3}
4
5int main() { return ns:: }
Sam McCallabdcc612018-01-24 17:50:20 +00006int main2() { return ns::foo(). }
Sam McCallbb2cf632018-01-12 14:51:47 +00007
Sam McCallabdcc612018-01-24 17:50:20 +00008// RUN: echo "namespace ns { struct foo { int baz }; }" > %t.h
Sam McCallbb2cf632018-01-12 14:51:47 +00009// RUN: c-index-test -write-pch %t.h.pch -x c++-header %t.h
10//
11// RUN: c-index-test -code-completion-at=%s:5:26 -include %t.h %s | FileCheck -check-prefix=WITH-PCH %s
12// WITH-PCH: {TypedText bar}
13// WITH-PCH: {TypedText foo}
14
15// RUN: env CINDEXTEST_COMPLETION_SKIP_PREAMBLE=1 c-index-test -code-completion-at=%s:5:26 -include %t.h %s | FileCheck -check-prefix=SKIP-PCH %s
16// SKIP-PCH-NOT: foo
17// SKIP-PCH: {TypedText bar}
18// SKIP-PCH-NOT: foo
19
Sam McCall091b1ef2018-01-16 12:33:46 +000020// Verify that with *no* preamble (no -include flag) we still get local results.
21// SkipPreamble used to break this, by making lookup *too* lazy.
22// RUN: env CINDEXTEST_COMPLETION_SKIP_PREAMBLE=1 c-index-test -code-completion-at=%s:5:26 %s | FileCheck -check-prefix=NO-PCH %s
23// NO-PCH-NOT: foo
24// NO-PCH: {TypedText bar}
25// NO-PCH-NOT: foo
26
Sam McCallabdcc612018-01-24 17:50:20 +000027// Verify that we still get member results from the preamble.
28// RUN: env CINDEXTEST_COMPLETION_SKIP_PREAMBLE=1 c-index-test -code-completion-at=%s:6:32 -include %t.h %s | FileCheck -check-prefix=MEMBER %s
29// MEMBER: {TypedText baz}
30