use of com.jetbrains.cidr.lang.psi.OCFile in project intellij by bazelbuild.
the class IwyuPragmasTest method insideNamespace_parseKeep.
@Test
public void insideNamespace_parseKeep() {
OCFile file = createFile("bar.cc", "#include \"f/foo1.h\" // IWYU pragma: keep", "#include \"f/foo2.h\"", "namespace change_namespace {", "#include \"f/foo3.h\" // IWYU pragma: keep", "}", "class C {", "#include \"f/foo4.h\" // IWYU pragma: keep", "};");
IwyuPragmas pragmas = IwyuPragmas.parse(file);
assertThat(pragmas.keeps).containsExactly(KeepPragma.create(IncludePath.create("f/foo1.h", Delimiters.QUOTES)), KeepPragma.create(IncludePath.create("f/foo3.h", Delimiters.QUOTES)), KeepPragma.create(IncludePath.create("f/foo4.h", Delimiters.QUOTES)));
}
use of com.jetbrains.cidr.lang.psi.OCFile in project intellij by bazelbuild.
the class IwyuPragmasTest method lineComment_parseKeep.
@Test
public void lineComment_parseKeep() {
OCFile file = createFile("bar.cc", "#include \"bar.h\"", "", "#include <memory>", "#include <vector> // IWYU pragma: keep", "", "#include \"f/foo1.h\" // IWYU pragma: keep", "#include \"f/foo2.h\"", "#include \"f/foo3.h\" // IWYU pragma: keep ", "", "void bar() {}");
IwyuPragmas pragmas = IwyuPragmas.parse(file);
assertThat(pragmas.keeps).containsExactly(KeepPragma.create(IncludePath.create("vector", Delimiters.ANGLE_BRACKETS)), KeepPragma.create(IncludePath.create("f/foo1.h", Delimiters.QUOTES)), KeepPragma.create(IncludePath.create("f/foo3.h", Delimiters.QUOTES)));
}
use of com.jetbrains.cidr.lang.psi.OCFile in project intellij by bazelbuild.
the class IwyuPragmasTest method blockComment_parseKeep.
@Test
public void blockComment_parseKeep() {
OCFile file = createFile("bar.cc", "#include \"bar.h\"", "", "#include <memory>", "#include <vector> /* IWYU pragma: keep */", "", "#include \"f/foo1.h\" /* IWYU pragma: keep */", "#include \"f/foo2.h\"", "#include \"f/foo3.h\" /* IWYU pragma: keep */", "", "void bar() {}");
IwyuPragmas pragmas = IwyuPragmas.parse(file);
assertThat(pragmas.keeps).containsExactly(KeepPragma.create(IncludePath.create("vector", Delimiters.ANGLE_BRACKETS)), KeepPragma.create(IncludePath.create("f/foo1.h", Delimiters.QUOTES)), KeepPragma.create(IncludePath.create("f/foo3.h", Delimiters.QUOTES)));
}
use of com.jetbrains.cidr.lang.psi.OCFile in project intellij by bazelbuild.
the class IwyuPragmasTest method exportRangePlusInlineKeep.
@Test
public void exportRangePlusInlineKeep() {
// Probably need to disambiguate the PSI nodes somewhere (last one shouldn't be kept?)
OCFile file = createFile("public/foo.h", "// IWYU pragma: begin_exports", "#include <memory>", "#include \"private/foo1.h\" // IWYU pragma: keep", "#include \"private/foo2.h\" // IWYU pragma: keep", "#include \"private/foo3.h\"", "// IWYU pragma: end_exports", "#include \"private/foo4.h\"", "", "void doFoo(Foo& f);");
IwyuPragmas pragmas = IwyuPragmas.parse(file);
assertThat(pragmas.keeps).containsExactly(KeepPragma.create(IncludePath.create("private/foo1.h", Delimiters.QUOTES)), KeepPragma.create(IncludePath.create("private/foo2.h", Delimiters.QUOTES)));
assertThat(pragmas.exports).containsExactly(ExportPragma.create(IncludePath.create("memory", Delimiters.ANGLE_BRACKETS)), ExportPragma.create(IncludePath.create("private/foo1.h", Delimiters.QUOTES)), ExportPragma.create(IncludePath.create("private/foo2.h", Delimiters.QUOTES)), ExportPragma.create(IncludePath.create("private/foo3.h", Delimiters.QUOTES)));
}
use of com.jetbrains.cidr.lang.psi.OCFile in project intellij by bazelbuild.
the class IwyuPragmasTest method lineCommentIncludeGuardPrefixes_parseKeep.
@Test
public void lineCommentIncludeGuardPrefixes_parseKeep() {
OCFile file = createFile("bar.h", "#ifndef BAR_H_", "#define BAR_H_", "#include <memory>", "#include <vector> // IWYU pragma: keep", "", "#include \"f/foo1.h\" // IWYU pragma: keep", "#include \"f/foo2.h\"", "#include \"f/foo3.h\" // IWYU pragma: keep ", "", "void bar();", "#endif");
IwyuPragmas pragmas = IwyuPragmas.parse(file);
assertThat(pragmas.keeps).containsExactly(KeepPragma.create(IncludePath.create("vector", Delimiters.ANGLE_BRACKETS)), KeepPragma.create(IncludePath.create("f/foo1.h", Delimiters.QUOTES)), KeepPragma.create(IncludePath.create("f/foo3.h", Delimiters.QUOTES)));
}
Aggregations