public void testFullyQualifiedDeprecatedTypeNameTranslation() throws IOException { Options.enableDeprecatedDeclarations(); String translation = translateSourceFile( "public @java.lang.Deprecated class Example {}", "Example", "Example.h"); assertTranslation(translation, "__attribute__((deprecated))\n@interface Example "); }
public void testDeprecatedInterfaceTranslation() throws IOException { Options.enableDeprecatedDeclarations(); String translation = translateSourceFile( "package unit.test; public @Deprecated interface Example {}", "Example", "unit/test/Example.h"); assertTranslation(translation, "__attribute__((deprecated))\n@protocol UnitTestExample"); }
public void testInterfaceWithDeprecatedMethodTranslation() throws IOException { Options.enableDeprecatedDeclarations(); String translation = translateSourceFile( "package unit.test; public interface Example { @Deprecated Example getExample(); }", "Example", "unit/test/Example.h"); assertTranslation( translation, "- (id<UnitTestExample>)getExample __attribute__((deprecated));"); }
public void testAddIgnoreDeprecationWarningsPragmaIfDeprecatedDeclarationsIsEnabled() throws IOException { Options.enableDeprecatedDeclarations(); String sourceContent = "class Test {}"; String translation = translateSourceFile(sourceContent, "FooBar", "FooBar.h"); assertTranslation(translation, "#pragma clang diagnostic push"); assertTranslation(translation, "#pragma GCC diagnostic ignored \"-Wdeprecated-declarations\""); assertTranslation(translation, "#pragma clang diagnostic pop"); }
public void testDeprecatedEnumType() throws IOException { Options.enableDeprecatedDeclarations(); String translation = translateSourceFile("@Deprecated public enum Test { A, B }", "Test", "Test.h"); assertTranslation(translation, "__attribute__((deprecated))\n@interface TestEnum"); }