Sam Jaffe 4 vuotta sitten
vanhempi
commit
159cdc1b97
3 muutettua tiedostoa jossa 43 lisäystä ja 11 poistoa
  1. 4 2
      string-utils.xcodeproj/project.pbxproj
  2. 1 9
      test/tokenizer_test.cxx
  3. 38 0
      test/xcode_gtest_helper.h

+ 4 - 2
string-utils.xcodeproj/project.pbxproj

@@ -53,6 +53,7 @@
 /* End PBXContainerItemProxy section */
 
 /* Begin PBXFileReference section */
+		CD11D62825D96C990088CB79 /* xcode_gtest_helper.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = xcode_gtest_helper.h; sourceTree = "<group>"; };
 		CD266862252FF4B600B3E667 /* libstring-utils.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libstring-utils.a"; sourceTree = BUILT_PRODUCTS_DIR; };
 		CD26686A252FF4E100B3E667 /* string_utils */ = {isa = PBXFileReference; lastKnownFileType = folder; name = string_utils; path = include/string_utils; sourceTree = "<group>"; };
 		CD26686D252FF51F00B3E667 /* GoogleMock.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = GoogleMock.xcodeproj; path = "../../../gmock-xcode-master/GoogleMock.xcodeproj"; sourceTree = "<group>"; };
@@ -107,6 +108,7 @@
 		CD266869252FF4C100B3E667 /* test */ = {
 			isa = PBXGroup;
 			children = (
+				CD11D62825D96C990088CB79 /* xcode_gtest_helper.h */,
 				CD266880252FFA7E00B3E667 /* tokenizer_test.cxx */,
 			);
 			path = test;
@@ -359,7 +361,7 @@
 				GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
 				GCC_WARN_UNUSED_FUNCTION = YES;
 				GCC_WARN_UNUSED_VARIABLE = YES;
-				MACOSX_DEPLOYMENT_TARGET = 10.14;
+				MACOSX_DEPLOYMENT_TARGET = 10.15;
 				MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE;
 				MTL_FAST_MATH = YES;
 				ONLY_ACTIVE_ARCH = YES;
@@ -415,7 +417,7 @@
 				GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
 				GCC_WARN_UNUSED_FUNCTION = YES;
 				GCC_WARN_UNUSED_VARIABLE = YES;
-				MACOSX_DEPLOYMENT_TARGET = 10.14;
+				MACOSX_DEPLOYMENT_TARGET = 10.15;
 				MTL_ENABLE_DEBUG_INFO = NO;
 				MTL_FAST_MATH = YES;
 				SDKROOT = macosx;

+ 1 - 9
test/tokenizer_test.cxx

@@ -8,18 +8,10 @@
 
 #include "string_utils/tokenizer.h"
 
-#include <gmock/gmock.h>
-#include <gtest/gtest.h>
+#include "xcode_gtest_helper.h"
 
 using namespace string_utils;
 
-#if XCODE_UNIT_TEST
-// This is a hack to allow XCode to properly display failures when running
-// unit tests.
-#undef EXPECT_THAT
-#define EXPECT_THAT ASSERT_THAT
-#endif
-
 TEST(TokenizerTest, SplitsStringOverToken) {
   std::string const input = "A.B.C.D";
   std::vector<std::string> const expected{"A", "B", "C", "D"};

+ 38 - 0
test/xcode_gtest_helper.h

@@ -0,0 +1,38 @@
+//
+//  xcode_gtest_helper.h
+//  tax-calculator-test
+//
+//  Created by Sam Jaffe on 11/25/20.
+//  Copyright © 2020 Sam Jaffe. All rights reserved.
+//
+
+#pragma once
+
+#if defined(__APPLE__)
+
+#pragma clang diagnostic push
+#pragma clang diagnostic ignored "-Wquoted-include-in-framework-header"
+
+#include <gmock/gmock.h>
+#include <gtest/gtest.h>
+
+#pragma clang diagnostic pop
+
+#if defined(TARGET_OS_OSX)
+// This is a hack to allow XCode to properly display failures when running
+// unit tests.
+#undef EXPECT_THAT
+#define EXPECT_THAT ASSERT_THAT
+#undef EXPECT_THROW
+#define EXPECT_THROW ASSERT_THROW
+#undef EXPECT_ANY_THROW
+#define EXPECT_ANY_THROW ASSERT_ANY_THROW
+#undef EXPECT_NO_THROW
+#define EXPECT_NO_THROW ASSERT_NO_THROW
+#undef EXPECT_TRUE
+#define EXPECT_TRUE ASSERT_TRUE
+#undef EXPECT_FALSE
+#define EXPECT_FALSE ASSERT_FALSE
+
+#endif
+#endif