use of com.jetbrains.cidr.lang.psi.OCFile in project intellij by bazelbuild.
the class IwyuPragmasTest method parsePrivateIncludeOtherAngle.
@Test
public void parsePrivateIncludeOtherAngle() {
OCFile file = createFile("private.h", "// IWYU pragma: private, include <f/public.h>", "#include \"private_details.h\"");
IwyuPragmas pragmas = IwyuPragmas.parse(file);
assertThat(pragmas.privatePragma.isPresent()).isTrue();
PrivatePragma privatePragma = pragmas.privatePragma.get();
assertThat(privatePragma.includeOther.isPresent()).isTrue();
assertThat(privatePragma.includeOther.get()).isEqualTo(IncludePath.create("f/public.h", Delimiters.ANGLE_BRACKETS));
}
use of com.jetbrains.cidr.lang.psi.OCFile in project intellij by bazelbuild.
the class IwyuPragmasTest method parsePrivateIncludeOtherNoQuotes.
@Test
public void parsePrivateIncludeOtherNoQuotes() {
OCFile file = createFile("private.h", "// IWYU pragma: private, include f/public.h", "#include \"private_details.h\"");
IwyuPragmas pragmas = IwyuPragmas.parse(file);
assertThat(pragmas.privatePragma.isPresent()).isTrue();
PrivatePragma privatePragma = pragmas.privatePragma.get();
assertThat(privatePragma.includeOther.isPresent()).isTrue();
assertThat(privatePragma.includeOther.get()).isEqualTo(IncludePath.create("f/public.h", Delimiters.NONE));
}
use of com.jetbrains.cidr.lang.psi.OCFile in project intellij by bazelbuild.
the class IwyuPragmasTest method incompletePragma_parseKeep.
@Test
public void incompletePragma_parseKeep() {
OCFile file = createFile("bar.cc", "#include \"f/foo1.h\" // IWYU pragma: kee", "#include \"f/foo2.h\" // IWYU pragma: keep");
IwyuPragmas pragmas = IwyuPragmas.parse(file);
assertThat(pragmas.keeps).containsExactly(KeepPragma.create(IncludePath.create("f/foo2.h", Delimiters.QUOTES)));
}
use of com.jetbrains.cidr.lang.psi.OCFile in project intellij by bazelbuild.
the class IwyuPragmasTest method parsePrivate.
@Test
public void parsePrivate() {
OCFile file = createFile("private.h", "// Stuff", "// IWYU pragma: private", "#include \"private_details.h\"");
IwyuPragmas pragmas = IwyuPragmas.parse(file);
assertThat(pragmas.privatePragma.isPresent()).isTrue();
PrivatePragma privatePragma = pragmas.privatePragma.get();
assertThat(privatePragma.includeOther.isPresent()).isFalse();
}
use of com.jetbrains.cidr.lang.psi.OCFile in project intellij by bazelbuild.
the class IwyuPragmasTest method multipleRanges_parseExportBeginEnd.
@Test
public void multipleRanges_parseExportBeginEnd() {
OCFile file = createFile("public/foo.h", "/** Stuff */", "// IWYU pragma: begin_exports", "#include <private/memory>", "#include \"private/foo1.h\"", "#include \"private/foo2.h\"", "// IWYU pragma: end_exports", "#include \"private/foo3.h\"", "#include \"private/foo4.h\"", " // IWYU pragma: begin_exports", "#include \"private/foo5.h\"", " // IWYU pragma: end_exports", "#include \"private/foo6.h\"", "", "void doFoo(Foo& f);");
IwyuPragmas pragmas = IwyuPragmas.parse(file);
assertThat(pragmas.exports).containsExactly(ExportPragma.create(IncludePath.create("private/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/foo5.h", Delimiters.QUOTES)));
}
Aggregations