FBRuntimeUtilsTests.m 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. /**
  2. * Copyright (c) 2015-present, Facebook, Inc.
  3. * All rights reserved.
  4. *
  5. * This source code is licensed under the BSD-style license found in the
  6. * LICENSE file in the root directory of this source tree. An additional grant
  7. * of patent rights can be found in the PATENTS file in the same directory.
  8. */
  9. #import <XCTest/XCTest.h>
  10. #import "FBRuntimeUtils.h"
  11. #import "XCTestPrivateSymbols.h"
  12. @protocol FBMagicProtocol <NSObject>
  13. @end
  14. const NSString *FBRuntimeUtilsTestsConstString = @"FBRuntimeUtilsTestsConstString";
  15. @interface FBRuntimeUtilsTests : XCTestCase <FBMagicProtocol>
  16. @end
  17. @implementation FBRuntimeUtilsTests
  18. - (void)testClassesThatConformsToProtocol
  19. {
  20. XCTAssertEqualObjects(@[self.class], FBClassesThatConformsToProtocol(@protocol(FBMagicProtocol)));
  21. }
  22. - (void)testRetrievingFrameworkSymbols
  23. {
  24. NSString *binaryPath = [NSBundle bundleForClass:self.class].executablePath;
  25. NSString *symbolPointer = *(NSString*__autoreleasing*)FBRetrieveSymbolFromBinary(binaryPath.UTF8String, "FBRuntimeUtilsTestsConstString");
  26. XCTAssertNotNil(symbolPointer);
  27. XCTAssertEqualObjects(symbolPointer, FBRuntimeUtilsTestsConstString);
  28. }
  29. - (void)testXCTestSymbols
  30. {
  31. XCTAssertTrue(XCDebugLogger != NULL);
  32. XCTAssertTrue(XCSetDebugLogger != NULL);
  33. XCTAssertNotNil(FB_XCAXAIsVisibleAttribute);
  34. XCTAssertNotNil(FB_XCAXAIsElementAttribute);
  35. }
  36. @end