use of com.google.idea.blaze.cpp.includes.IwyuPragmas.PrivatePragma in project intellij by bazelbuild.
the class IwyuPragmasTest method parsePrivateIncludeOther.
@Test
public void parsePrivateIncludeOther() {
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.QUOTES));
}
use of com.google.idea.blaze.cpp.includes.IwyuPragmas.PrivatePragma in project intellij by bazelbuild.
the class IwyuPragmasTest method withWhiteSpace_parsePrivateIncludeOther.
@Test
public void withWhiteSpace_parsePrivateIncludeOther() {
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.QUOTES));
}
use of com.google.idea.blaze.cpp.includes.IwyuPragmas.PrivatePragma in project intellij by bazelbuild.
the class IwyuPragmasTest method sortOfCommentViaIfdef_parsePrivate.
@Test
public void sortOfCommentViaIfdef_parsePrivate() {
OCFile file = createFile("bar.cc", "#include <memory>", "#if 0", "IWYU pragma: private", "#endif");
IwyuPragmas pragmas = IwyuPragmas.parse(file);
// We don't really support this, but #ifdef'ed out things may be parsed as PsiComment,
// so at least make sure we don't assert. Answer could go either way.
assertThat(pragmas.privatePragma.isPresent()).isTrue();
PrivatePragma privatePragma = pragmas.privatePragma.get();
assertThat(privatePragma.includeOther.isPresent()).isFalse();
}
use of com.google.idea.blaze.cpp.includes.IwyuPragmas.PrivatePragma 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.google.idea.blaze.cpp.includes.IwyuPragmas.PrivatePragma 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));
}
Aggregations