Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(228)

Issue 3028047: This adds adds four macros when compiling using GTEST_OS_MAC: (Closed)

Created:
10 years, 4 months ago by Robert Sesek
Modified:
9 years, 7 months ago
CC:
chromium-reviews, John Grabowski, pam+watch_chromium.org, Paweł Hajdan Jr.
Visibility:
Public.

Description

This adds adds four macros when compiling using GTEST_OS_MAC: {ASSERT,EXPECT}_NS{NE,EQ}. These test ObjC objects using |-isEqual:| and prints failures using the |-description| selector. This allows for better debugging output with ObjC++ test cases. BUG=http://code.google.com/p/googletest/issues/detail?id=303 TEST=Covered by unit tests. Committed: http://src.chromium.org/viewvc/chrome?view=rev&revision=55180

Patch Set 1 #

Total comments: 2

Patch Set 2 : Fix compile #

Total comments: 3
Unified diffs Side-by-side diffs Delta from patch set Stats (+151 lines, -0 lines) Patch
M chrome/chrome_tests.gypi View 1 chunk +1 line, -0 lines 0 comments Download
M testing/gtest.gyp View 1 chunk +2 lines, -0 lines 0 comments Download
A testing/gtest_mac.h View 1 1 chunk +48 lines, -0 lines 0 comments Download
A testing/gtest_mac.mm View 1 1 chunk +53 lines, -0 lines 2 comments Download
A testing/gtest_mac_unittest.mm View 1 chunk +47 lines, -0 lines 1 comment Download

Messages

Total messages: 11 (0 generated)
Robert Sesek
10 years, 4 months ago (2010-08-05 22:56:03 UTC) #1
Mark Mentovai
lg™ http://codereview.chromium.org/3028047/diff/1/4 File testing/gtest_mac.h (right): http://codereview.chromium.org/3028047/diff/1/4#newcode5 testing/gtest_mac.h:5: #ifndef TESTING_GTEST_GTEST_MAC_H_ There’s an extra GTEST_ in here ...
10 years, 4 months ago (2010-08-05 23:01:15 UTC) #2
Paweł Hajdan Jr.
Oh, have we sent those upstream?
10 years, 4 months ago (2010-08-05 23:34:27 UTC) #3
Robert Sesek
On 2010/08/05 23:34:27, Paweł Hajdan Jr. wrote: > Oh, have we sent those upstream? They ...
10 years, 4 months ago (2010-08-05 23:35:54 UTC) #4
Paweł Hajdan Jr.
The latest Zhanyong's e-mail has some alternative suggestions. I'd really like to avoid forking every ...
10 years, 4 months ago (2010-08-05 23:39:36 UTC) #5
Mark Mentovai
Paweł Hajdan, Jr. wrote: > The latest Zhanyong's e-mail has some alternative suggestions. I'd really ...
10 years, 4 months ago (2010-08-05 23:42:54 UTC) #6
Robert Sesek
On 2010/08/05 23:39:36, Paweł Hajdan Jr. wrote: > The latest Zhanyong's e-mail has some alternative ...
10 years, 4 months ago (2010-08-05 23:43:35 UTC) #7
Robert Sesek
This fixes compile because NeFailure is no longer in the CL. http://codereview.chromium.org/3028047/diff/1/4 File testing/gtest_mac.h (right): ...
10 years, 4 months ago (2010-08-05 23:47:13 UTC) #8
Mark Mentovai
LGTM
10 years, 4 months ago (2010-08-05 23:49:44 UTC) #9
Avi (use Gerrit)
http://codereview.chromium.org/3028047/diff/8001/9005 File testing/gtest_mac_unittest.mm (right): http://codereview.chromium.org/3028047/diff/8001/9005#newcode33 testing/gtest_mac_unittest.mm:33: EXPECT_NE(n1, n2); Is this a valid assumption?
10 years, 4 months ago (2010-08-05 23:51:15 UTC) #10
Scott Hess - ex-Googler
10 years, 4 months ago (2010-08-10 00:00:33 UTC) #11
drive-by commenting.

http://codereview.chromium.org/3028047/diff/8001/9004
File testing/gtest_mac.mm (right):

http://codereview.chromium.org/3028047/diff/8001/9004#newcode23
testing/gtest_mac.mm:23: id<NSObject> actual) {
Suggest you add something like:

  if (!expected && !actual)
    return AssertionSuccess();
  else if (!expected)
    return EqFailure(expected_expr, actual_expr, "<nil>", String(...), false);
  else if (!actual)
    return EqFailure(expected_expr, actual_expr, String(...), "<nil>", false);

Purpose is two-fold, both nil should be treated as eq, and provide a more useful
diagnostic otherwise.  Hmm, and -isEqual:nil might be poor.

http://codereview.chromium.org/3028047/diff/8001/9004#newcode40
testing/gtest_mac.mm:40: if (![expected isEqual:actual]) {
This isn't right if !expected && !actual.  And likely similar reasoning to above
for better diagnostic output.

Powered by Google App Engine
This is Rietveld 408576698