aboutsummaryrefslogtreecommitdiff
path: root/UnitTesting
diff options
context:
space:
mode:
authorGravatar gtm.daemon <gtm.daemon@7dc7ac4e-7543-0410-b95c-c1676fc8e2a3>2009-03-27 17:15:24 +0000
committerGravatar gtm.daemon <gtm.daemon@7dc7ac4e-7543-0410-b95c-c1676fc8e2a3>2009-03-27 17:15:24 +0000
commite3c268753ab7a8cf62bdf66d64d86707a850a933 (patch)
tree24c0380f59a0ec0d5f9999e53ea634c0b1b974c1 /UnitTesting
parent6545da262e160fc959e1fe869c517daeff1e184e (diff)
[Author: dmaclach]
Change build script so that it removes all of the gcda files for the current config project wide, which in general is what people will want. Added unit testing to GTMHotKeyTextField. From about 6% up to 90%. DELTA=10 (3 added, 0 deleted, 7 changed) R=thomasvl
Diffstat (limited to 'UnitTesting')
-rw-r--r--UnitTesting/GTMSenTestCase.m22
-rw-r--r--UnitTesting/GTMUIUnitTestingHarness/English.lproj/MainMenu.nib/keyedobjects.nibbin16183 -> 0 bytes
-rw-r--r--UnitTesting/GTMUIUnitTestingHarness/English.lproj/MainMenu.xib (renamed from UnitTesting/GTMUIUnitTestingHarness/English.lproj/MainMenu.nib/designable.nib)85
-rwxr-xr-xUnitTesting/RunMacOSUnitTests.sh24
-rw-r--r--UnitTesting/TestData/GTMUnitTestingTestApp.gtmUTState2
5 files changed, 95 insertions, 38 deletions
diff --git a/UnitTesting/GTMSenTestCase.m b/UnitTesting/GTMSenTestCase.m
index 8482c5a..99b9db0 100644
--- a/UnitTesting/GTMSenTestCase.m
+++ b/UnitTesting/GTMSenTestCase.m
@@ -312,6 +312,8 @@ NSString *const SenTestLineNumberKey = @"SenTestLineNumberKey";
// Don't want to get leaks on the iPhone Device as the device doesn't
// have 'leaks'. The simulator does though.
+// COV_NF_START
+// We don't have leak checking on by default, so this won't be hit.
static void _GTMRunLeaks(void) {
// This is an atexit handler. It runs leaks for us to check if we are
// leaking anything in our tests.
@@ -338,6 +340,7 @@ static void _GTMRunLeaks(void) {
fflush(stderr);
}
}
+// COV_NF_END
static __attribute__((constructor)) void _GTMInstallLeaks(void) {
BOOL checkLeaks = YES;
@@ -347,15 +350,16 @@ static __attribute__((constructor)) void _GTMInstallLeaks(void) {
if (checkLeaks) {
checkLeaks = getenv("GTM_ENABLE_LEAKS") ? YES : NO;
if (checkLeaks) {
- if (checkLeaks) {
- fprintf(stderr, "Leak Checking Enabled\n");
- fflush(stderr);
- int ret = atexit(&_GTMRunLeaks);
- _GTMDevAssert(ret == 0,
- @"Unable to install _GTMRunLeaks as an atexit handler (%d)",
- errno);
- }
- }
+ // COV_NF_START
+ // We don't have leak checking on by default, so this won't be hit.
+ fprintf(stderr, "Leak Checking Enabled\n");
+ fflush(stderr);
+ int ret = atexit(&_GTMRunLeaks);
+ _GTMDevAssert(ret == 0,
+ @"Unable to install _GTMRunLeaks as an atexit handler (%d)",
+ errno);
+ // COV_NF_END
+ }
}
}
diff --git a/UnitTesting/GTMUIUnitTestingHarness/English.lproj/MainMenu.nib/keyedobjects.nib b/UnitTesting/GTMUIUnitTestingHarness/English.lproj/MainMenu.nib/keyedobjects.nib
deleted file mode 100644
index 318a7e9..0000000
--- a/UnitTesting/GTMUIUnitTestingHarness/English.lproj/MainMenu.nib/keyedobjects.nib
+++ /dev/null
Binary files differ
diff --git a/UnitTesting/GTMUIUnitTestingHarness/English.lproj/MainMenu.nib/designable.nib b/UnitTesting/GTMUIUnitTestingHarness/English.lproj/MainMenu.xib
index e198162..6cef0cb 100644
--- a/UnitTesting/GTMUIUnitTestingHarness/English.lproj/MainMenu.nib/designable.nib
+++ b/UnitTesting/GTMUIUnitTestingHarness/English.lproj/MainMenu.xib
@@ -1,20 +1,29 @@
<?xml version="1.0" encoding="UTF-8"?>
-<archive type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="7.02">
+<archive type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="7.03">
<data>
<int key="IBDocument.SystemTarget">0</int>
- <string key="IBDocument.SystemVersion">9C31</string>
- <string key="IBDocument.InterfaceBuilderVersion">644</string>
- <string key="IBDocument.AppKitVersion">949.26</string>
- <string key="IBDocument.HIToolboxVersion">352.00</string>
+ <string key="IBDocument.SystemVersion">9G55</string>
+ <string key="IBDocument.InterfaceBuilderVersion">677</string>
+ <string key="IBDocument.AppKitVersion">949.43</string>
+ <string key="IBDocument.HIToolboxVersion">353.00</string>
<object class="NSMutableArray" key="IBDocument.EditedObjectIDs">
<bool key="EncodedWithXMLCoder">YES</bool>
- <integer value="57"/>
+ <integer value="29"/>
</object>
<object class="NSArray" key="IBDocument.PluginDependencies">
<bool key="EncodedWithXMLCoder">YES</bool>
<string>com.apple.InterfaceBuilderKit</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
</object>
+ <object class="NSMutableDictionary" key="IBDocument.Metadata">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <object class="NSArray" key="dict.sortedKeys">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ </object>
+ <object class="NSMutableArray" key="dict.values">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ </object>
+ </object>
<object class="NSMutableArray" key="IBDocument.RootObjects" id="1048">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="NSCustomObject" id="1021">
@@ -157,8 +166,7 @@
<object class="NSMenuItem" id="632727374">
<reference key="NSMenu" ref="110575045"/>
<string key="NSTitle">Quit NewApplication</string>
- <string key="NSKeyEquiv">q</string>
- <int key="NSKeyEquivModMask">1048576</int>
+ <string key="NSKeyEquiv"/>
<int key="NSMnemonicLoc">2147483647</int>
<reference key="NSOnImage" ref="35465992"/>
<reference key="NSMixedImage" ref="513340101"/>
@@ -1909,24 +1917,41 @@
<object class="NSMutableArray" key="referencedPartialClassDescriptions">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="IBPartialClassDescription">
- <string key="className">NSApplication</string>
+ <string key="className">GTMLargeTypeWindow</string>
+ <string key="superclassName">NSPanel</string>
+ <object class="NSMutableDictionary" key="actions">
+ <string key="NS.key.0">copy:</string>
+ <string key="NS.object.0">id</string>
+ </object>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBProjectSource</string>
- <string key="minorKey">UnitTesting/GTMNSApplication+UnitTesting.h</string>
+ <string key="minorKey">AppKit/GTMLargeTypeWindow.h</string>
</object>
</object>
<object class="IBPartialClassDescription">
- <string key="className">NSMenu</string>
- <object class="IBClassDescriptionSource" key="sourceIdentifier">
+ <string key="className">NSApplication</string>
+ <object class="IBClassDescriptionSource" key="sourceIdentifier" id="271775925">
<string key="majorKey">IBProjectSource</string>
- <string key="minorKey">UnitTesting/GTMNSMenu+UnitTesting.h</string>
+ <string key="minorKey">UnitTesting/GTMAppKit+UnitTesting.h</string>
</object>
</object>
<object class="IBPartialClassDescription">
+ <string key="className">NSControl</string>
+ <reference key="sourceIdentifier" ref="271775925"/>
+ </object>
+ <object class="IBPartialClassDescription">
+ <string key="className">NSMenu</string>
+ <reference key="sourceIdentifier" ref="271775925"/>
+ </object>
+ <object class="IBPartialClassDescription">
<string key="className">NSMenuItem</string>
+ <reference key="sourceIdentifier" ref="271775925"/>
+ </object>
+ <object class="IBPartialClassDescription">
+ <string key="className">NSObject</string>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBProjectSource</string>
- <string key="minorKey">UnitTesting/GTMNSMenuItem+UnitTesting.h</string>
+ <string key="minorKey">AppKit/GTMCarbonEvent.h</string>
</object>
</object>
<object class="IBPartialClassDescription">
@@ -1940,30 +1965,52 @@
<string key="className">NSObject</string>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBProjectSource</string>
- <string key="minorKey">UnitTesting/GTMNSObject+BindingUnitTesting.h</string>
+ <string key="minorKey">Foundation/GTMHTTPServer.h</string>
</object>
</object>
<object class="IBPartialClassDescription">
<string key="className">NSObject</string>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBProjectSource</string>
- <string key="minorKey">UnitTesting/GTMNSObject+UnitTesting.h</string>
+ <string key="minorKey">Foundation/GTMNSAppleEventDescriptor+Foundation.h</string>
</object>
</object>
<object class="IBPartialClassDescription">
<string key="className">NSObject</string>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBProjectSource</string>
- <string key="minorKey">UnitTesting/GTMSenTestCase.h</string>
+ <string key="minorKey">Foundation/GTMNSObject+KeyValueObserving.h</string>
</object>
</object>
<object class="IBPartialClassDescription">
- <string key="className">NSView</string>
+ <string key="className">NSObject</string>
+ <object class="IBClassDescriptionSource" key="sourceIdentifier">
+ <string key="majorKey">IBProjectSource</string>
+ <string key="minorKey">UnitTesting/GTMCALayer+UnitTesting.h</string>
+ </object>
+ </object>
+ <object class="IBPartialClassDescription">
+ <string key="className">NSObject</string>
+ <object class="IBClassDescriptionSource" key="sourceIdentifier">
+ <string key="majorKey">IBProjectSource</string>
+ <string key="minorKey">UnitTesting/GTMNSObject+BindingUnitTesting.h</string>
+ </object>
+ </object>
+ <object class="IBPartialClassDescription">
+ <string key="className">NSObject</string>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBProjectSource</string>
- <string key="minorKey">UnitTesting/GTMNSView+UnitTesting.h</string>
+ <string key="minorKey">UnitTesting/GTMNSObject+UnitTesting.h</string>
</object>
</object>
+ <object class="IBPartialClassDescription">
+ <string key="className">NSView</string>
+ <reference key="sourceIdentifier" ref="271775925"/>
+ </object>
+ <object class="IBPartialClassDescription">
+ <string key="className">NSWindow</string>
+ <reference key="sourceIdentifier" ref="271775925"/>
+ </object>
</object>
</object>
<int key="IBDocument.localizationMode">0</int>
diff --git a/UnitTesting/RunMacOSUnitTests.sh b/UnitTesting/RunMacOSUnitTests.sh
index 9aa83e4..d184566 100755
--- a/UnitTesting/RunMacOSUnitTests.sh
+++ b/UnitTesting/RunMacOSUnitTests.sh
@@ -43,10 +43,16 @@
# Please feel free to add other symbols as you find them but make sure to
# reference Radars or other bug systems so we can track them.
#
-# GTM_REMOVE_GCOV_DATA
-# Before starting the test, remove any *.gcda files for the current run so
-# you won't get errors when the source file has changed and the data can't
-# be merged.
+# GTM_DO_NOT_REMOVE_GCOV_DATA
+# By default before starting the test, we remove any *.gcda files for the
+# current project build configuration so you won't get errors when a source
+# file has changed and the gcov data can't be merged.
+# We remove all the gcda files for the current configuration for the entire
+# project so that if you are building a test bundle to test another separate
+# bundle we make sure to clean up the files for the test bundle and the bundle
+# that you are testing.
+# If you DO NOT want this to occur, set GTM_DO_NOT_REMOVE_GCOV_DATA to a
+# non-zero value.
#
ScriptDir=$(dirname $(echo $0 | sed -e "s,^\([^/]\),$(pwd)/\1,"))
@@ -200,11 +206,11 @@ if [ ! $GTM_DISABLE_ZOMBIES ]; then
export NSZombieEnabled=YES
fi
-if [ $GTM_REMOVE_GCOV_DATA ]; then
- if [ "${OBJECT_FILE_DIR}-${CURRENT_VARIANT}" != "-" ]; then
- if [ -d "${OBJECT_FILE_DIR}-${CURRENT_VARIANT}" ]; then
- GTMXcodeNote ${LINENO} "Removing any .gcda files"
- (cd "${OBJECT_FILE_DIR}-${CURRENT_VARIANT}" && \
+if [ ! $GTM_DO_NOT_REMOVE_GCOV_DATA ]; then
+ if [ "${CONFIGURATION_TEMP_DIR}" != "-" ]; then
+ if [ -d "${CONFIGURATION_TEMP_DIR}" ]; then
+ GTMXcodeNote ${LINENO} "Removing gcov data files from ${CONFIGURATION_TEMP_DIR}"
+ (cd "${CONFIGURATION_TEMP_DIR}" && \
find . -type f -name "*.gcda" -print0 | xargs -0 rm -f )
fi
fi
diff --git a/UnitTesting/TestData/GTMUnitTestingTestApp.gtmUTState b/UnitTesting/TestData/GTMUnitTestingTestApp.gtmUTState
index 03e611c..525535b 100644
--- a/UnitTesting/TestData/GTMUnitTestingTestApp.gtmUTState
+++ b/UnitTesting/TestData/GTMUnitTestingTestApp.gtmUTState
@@ -91,7 +91,7 @@
<key>MenuItemIsSeparator</key>
<false/>
<key>MenuItemKeyEquivalent</key>
- <string>q</string>
+ <string></string>
<key>MenuItemState</key>
<integer>0</integer>
<key>MenuItemTag</key>