From a4501462ccde5b652f40db964a71fe4b8d735909 Mon Sep 17 00:00:00 2001 From: Ryan Rhee Date: Thu, 20 Oct 2016 12:54:50 -0700 Subject: [PATCH] [componentkit] Reference fake header in build system test Reviewed By: dulmarod Differential Revision: D4033937 fbshipit-source-id: adccbd6 --- .../build_systems/build_integration_tests.py | 2 +- .../componentkit/TestIgnoreImports.mm | 18 +----------------- .../componentkit/FakeComponentKitHeader.h | 15 +++++++++++++++ 3 files changed, 17 insertions(+), 18 deletions(-) diff --git a/infer/tests/build_systems/build_integration_tests.py b/infer/tests/build_systems/build_integration_tests.py index ee1593b67..c508e3fab 100755 --- a/infer/tests/build_systems/build_integration_tests.py +++ b/infer/tests/build_systems/build_integration_tests.py @@ -498,7 +498,7 @@ class BuildIntegrationTest(unittest.TestCase): test('componentkit', 'component quality analyzer skips imports', os.path.join(CODETOANALYZE_DIR, 'componentkit'), [{'compile': ['clang', '-x', 'objective-c++', '-std=c++11', '-c', - 'TestIgnoreImports.mm'], + '-fblocks', 'TestIgnoreImports.mm'], 'infer_args': ['--cxx', '--no-filtering', '-a', 'linters']}]) def test_fail_on_issue(self): diff --git a/infer/tests/build_systems/codetoanalyze/componentkit/TestIgnoreImports.mm b/infer/tests/build_systems/codetoanalyze/componentkit/TestIgnoreImports.mm index 9d08f7713..6bf48b8e8 100644 --- a/infer/tests/build_systems/codetoanalyze/componentkit/TestIgnoreImports.mm +++ b/infer/tests/build_systems/codetoanalyze/componentkit/TestIgnoreImports.mm @@ -9,23 +9,7 @@ #include "HeaderWithMutableLocalVar.h" -#define nil 0 - -// Mimic importing CKComponnet -@interface CKComponent -@end -@implementation CKComponent -@end - -// Mimic importing CKCompositeComponnet -@interface CKCompositeComponent : CKComponent -+ (instancetype)newWithComponent:(CKComponent*)component; -@end -@implementation CKCompositeComponent -+ (instancetype)newWithComponent:(CKComponent*)component { - return nil; -} -@end +#include "../../../codetoanalyze/objcpp/linters/componentkit/FakeComponentKitHeader.h" @interface SomeClass : CKCompositeComponent @end diff --git a/infer/tests/codetoanalyze/objcpp/linters/componentkit/FakeComponentKitHeader.h b/infer/tests/codetoanalyze/objcpp/linters/componentkit/FakeComponentKitHeader.h index 9785cd334..034ba5899 100644 --- a/infer/tests/codetoanalyze/objcpp/linters/componentkit/FakeComponentKitHeader.h +++ b/infer/tests/codetoanalyze/objcpp/linters/componentkit/FakeComponentKitHeader.h @@ -7,7 +7,22 @@ * of patent rights can be found in the PATENTS file in the same directory. */ +#ifdef __APPLE__ #import +#elif __linux__ +// fake foundation enough so linux doesn't complain +#define nil 0 +@interface NSObject +@end +@implementation NSObject +@end +@interface NSString : NSObject +@end +@implementation NSString +@end +#else +#error "Need either os x or linux" +#endif // Mimic importing CKComponnet @interface CKComponent : NSObject