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

Issue 202057: Replace EXPECT_EQ(NULL, foo) with EXPECT_TRUE(NULL == foo).... (Closed)

Created:
11 years, 3 months ago by Jacob Mandelson
Modified:
9 years, 7 months ago
CC:
jacob_mandelson.org, chromium-reviews_googlegroups.com, fbarchard, willchan no longer on Chromium, Alpha Left Google, Erik does not do reviews, pam+watch_chromium.org, awong, Paweł Hajdan Jr., darin (slow to review), brettw, Ben Goodger (Google), scherkus (not reviewing)
Visibility:
Public.

Description

Replace EXPECT_EQ(NULL, foo) with EXPECT_TRUE(foo == NULL). Using NULL as an argument to EXPECT_EQ or ASSERT_EQ is problematic, because it passes NULL to a template function expecting a const int &, which can trigger a NULL used as int warning. An alternative would be EXPECT_FALSE(foo), but some people find that confusing. Another alternative would be to make EXPECT_NULL and EXPECT_NOT_NULL which take templated T*. Ran tests on Linux. Passed except for ConditionVariableTest.LargeFastTaskTest, which also fails without patch. BUG=none TEST=app_unittests & base_unittests & media_unittests

Patch Set 1 #

Total comments: 1

Patch Set 2 : '' #

Patch Set 3 : '' #

Patch Set 4 : '' #

Total comments: 1
Unified diffs Side-by-side diffs Delta from patch set Stats (+59 lines, -62 lines) Patch
M base/field_trial_unittest.cc View 1 2 3 1 chunk +2 lines, -2 lines 0 comments Download
M base/waitable_event_watcher_unittest.cc View 1 2 3 3 chunks +3 lines, -3 lines 0 comments Download
M base/weak_ptr_unittest.cc View 1 2 3 3 chunks +5 lines, -5 lines 0 comments Download
M chrome/browser/net/resolve_proxy_msg_helper_unittest.cc View 1 2 3 1 chunk +1 line, -1 line 0 comments Download
M chrome/common/extensions/extension_unittest.cc View 1 2 3 1 chunk +4 lines, -4 lines 0 comments Download
M chrome/common/property_bag_unittest.cc View 1 2 3 4 chunks +5 lines, -5 lines 0 comments Download
M media/audio/linux/alsa_output_unittest.cc View 1 2 3 1 chunk +1 line, -1 line 0 comments Download
M media/filters/ffmpeg_demuxer_unittest.cc View 1 2 3 2 chunks +2 lines, -2 lines 0 comments Download
M net/base/host_cache_unittest.cc View 1 2 3 7 chunks +17 lines, -17 lines 0 comments Download
M net/base/ssl_client_auth_cache_unittest.cc View 1 2 3 2 chunks +3 lines, -3 lines 0 comments Download
M net/ftp/ftp_auth_cache_unittest.cc View 1 2 3 5 chunks +6 lines, -6 lines 0 comments Download
M net/http/http_network_transaction_unittest.cc View 1 2 3 2 chunks +5 lines, -5 lines 1 comment Download
M net/proxy/single_threaded_proxy_resolver_unittest.cc View 1 2 3 1 chunk +2 lines, -2 lines 0 comments Download
M net/socket/client_socket_pool_base_unittest.cc View 1 2 3 2 chunks +3 lines, -6 lines 0 comments Download

Messages

Total messages: 11 (0 generated)
Jacob Mandelson
(Split off from CL 171028)
11 years, 3 months ago (2009-09-11 04:45:51 UTC) #1
Paweł Hajdan Jr.
http://codereview.chromium.org/202057/diff/1/6 File net/socket/client_socket_pool_base_unittest.cc (right): http://codereview.chromium.org/202057/diff/1/6#newcode344 Line 344: EXPECT_FALSE(socket.get() == NULL); Hmm... IMHO EXPECT_TRUE(... != NULL) ...
11 years, 3 months ago (2009-09-11 15:44:40 UTC) #2
Peter Kasting
The idea here is OK, but we don't use "const == var" style in Chromium ...
11 years, 3 months ago (2009-09-11 15:54:16 UTC) #3
Jacob Mandelson
> Line 344: EXPECT_FALSE(socket.get() == NULL); > Hmm... IMHO EXPECT_TRUE(... != NULL) is more intuitive. ...
11 years, 2 months ago (2009-09-26 21:50:09 UTC) #4
Peter Kasting
Already said LGTM, you need to tell us if you want someone to commit this ...
11 years, 2 months ago (2009-09-28 01:19:37 UTC) #5
Jacob Mandelson
On 2009/09/28 01:19:37, Peter Kasting wrote: > Already said LGTM, you need to tell us ...
11 years, 2 months ago (2009-09-28 21:33:31 UTC) #6
Peter Kasting
Landed in r27511.
11 years, 2 months ago (2009-09-29 18:13:18 UTC) #7
wtc
http://codereview.chromium.org/202057/diff/9009/8010 File net/http/http_network_transaction_unittest.cc (right): http://codereview.chromium.org/202057/diff/9009/8010#newcode1 Line 1: // Copyright (c) 2009 The Chromium Authors. All ...
11 years, 2 months ago (2009-10-02 23:59:32 UTC) #8
Peter Kasting
On 2009/10/02 23:59:32, wtc wrote: > http://codereview.chromium.org/202057/diff/9009/8010#newcode1 > Line 1: // Copyright (c) 2009 The ...
11 years, 2 months ago (2009-10-03 00:00:56 UTC) #9
wtc
On 2009/10/03 00:00:56, Peter Kasting wrote: > > No, it has always been the policy ...
11 years, 2 months ago (2009-10-03 00:14:04 UTC) #10
Peter Kasting
11 years, 2 months ago (2009-10-03 16:38:12 UTC) #11
On Fri, Oct 2, 2009 at 5:14 PM, <wtc@chromium.org> wrote:

> Our coding style guide still uses 2006-2009 as an example:
> http://dev.chromium.org/developers/coding-style#TOC-File-headers
>
> Can we have a lawyer update that page authoritatively?


I updated it. I forwarded you the original email from Rebecca that addresses
this question, so you wouldn't have to worry about whether it was justified
:)

http://codereview.chromium.org/202057
>

Powered by Google App Engine
This is Rietveld 408576698