summaryrefslogtreecommitdiffstats
path: root/mojo
diff options
context:
space:
mode:
authorviettrungluu@chromium.org <viettrungluu@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-02-21 18:16:48 +0000
committerviettrungluu@chromium.org <viettrungluu@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-02-21 18:16:48 +0000
commita9b24304db8e19cc8ee2cf866ea85024de943778 (patch)
tree40bacddc39475cf76dd10ca040b10be1d1a52ee7 /mojo
parentc6b8d3634705b97a188e7df42cc1ed507c44eab2 (diff)
downloadchromium_src-a9b24304db8e19cc8ee2cf866ea85024de943778.zip
chromium_src-a9b24304db8e19cc8ee2cf866ea85024de943778.tar.gz
chromium_src-a9b24304db8e19cc8ee2cf866ea85024de943778.tar.bz2
Revert 252593 "Mojo: Write some tests for public/system/macros.h."
> Mojo: Write some tests for public/system/macros.h. > > I really set out to also write no-compile tests, but they're currently totally > disabled. :( > > R=sky@chromium.org > > Review URL: https://codereview.chromium.org/175343002 TBR=viettrungluu@chromium.org Review URL: https://codereview.chromium.org/169433003 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@252596 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'mojo')
-rw-r--r--mojo/mojo_public.gypi1
-rw-r--r--mojo/public/system/macros.h1
-rw-r--r--mojo/public/tests/system/macros_unittest.cc143
3 files changed, 0 insertions, 145 deletions
diff --git a/mojo/mojo_public.gypi b/mojo/mojo_public.gypi
index 21dcd0f..d4929fe 100644
--- a/mojo/mojo_public.gypi
+++ b/mojo/mojo_public.gypi
@@ -145,7 +145,6 @@
'public/tests/system/core_cpp_unittest.cc',
'public/tests/system/core_unittest.cc',
'public/tests/system/core_unittest_pure_c.c',
- 'public/tests/system/macros_unittest.cc',
],
},
{
diff --git a/mojo/public/system/macros.h b/mojo/public/system/macros.h
index b31469f..4bd5e77 100644
--- a/mojo/public/system/macros.h
+++ b/mojo/public/system/macros.h
@@ -19,7 +19,6 @@
// Annotate a function indicating that the caller must examine the return value.
// Use like:
// int foo() MOJO_WARN_UNUSED_RESULT;
-// Note that it can only be used on the prototype, and not the definition.
#if defined(__GNUC__)
#define MOJO_WARN_UNUSED_RESULT __attribute__((warn_unused_result))
#else
diff --git a/mojo/public/tests/system/macros_unittest.cc b/mojo/public/tests/system/macros_unittest.cc
deleted file mode 100644
index edc8a66..0000000
--- a/mojo/public/tests/system/macros_unittest.cc
+++ /dev/null
@@ -1,143 +0,0 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-// This file consists of "positive" tests, i.e., those verifying that things
-// work (without compile errors, or even warnings if warnings are treated as
-// errors).
-// TODO(vtl): Fix no-compile tests (which are all disabled; crbug.com/105388)
-// and write some "negative" tests.
-
-#include "mojo/public/system/macros.h"
-
-#include <assert.h>
-#include <stdint.h>
-#include <stdlib.h>
-
-#include "mojo/public/system/macros.h"
-#include "testing/gtest/include/gtest/gtest.h"
-
-namespace mojo {
-namespace {
-
-TEST(MacrosTest, AllowUnused) {
- // Test that no warning/error is issued even though |x| is unused.
- int x MOJO_ALLOW_UNUSED = 123;
-}
-
-int MustUseReturnedResult() MOJO_WARN_UNUSED_RESULT;
-int MustUseReturnedResult() {
- return 456;
-}
-
-TEST(MacrosTest, WarnUnusedResult) {
- if (!MustUseReturnedResult())
- abort();
-}
-
-TEST(MacrosTest, Override) {
- struct BaseClass {
- virtual ~BaseClass() {}
- virtual void ToBeOverridden() {}
- virtual void AlsoToBeOverridden() = 0;
- };
-
- struct Subclass : public BaseClass {
- virtual ~Subclass() {}
- virtual void ToBeOverridden() MOJO_OVERRIDE {}
- virtual void AlsoToBeOverridden() MOJO_OVERRIDE {}
- };
-
- Subclass x;
- x.ToBeOverridden();
- x.AlsoToBeOverridden();
-}
-
-TEST(MacrosTest, DisallowCopyAndAssign) {
- class Class {
- public:
- Class() {}
- explicit Class(int) {}
- void NoOp() {}
-
- private:
- MOJO_DISALLOW_COPY_AND_ASSIGN(Class);
- };
-
- Class x;
- x.NoOp();
- Class y(789);
- y.NoOp();
-}
-
-// First test |MOJO_COMPILE_ASSERT()| in a global scope.
-MOJO_COMPILE_ASSERT(sizeof(int64_t) == 2 * sizeof(int32_t),
- bad_compile_assert_failure_in_global_scope);
-
-TEST(MacrosTest, CompileAssert) {
- // Then in a local scope.
- MOJO_COMPILE_ASSERT(sizeof(int32_t) == 2 * sizeof(int16_t),
- bad_compile_assert_failure);
-}
-
-// Test that |MOJO_ARRAYSIZE()| works in a |MOJO_COMPILE_ASSERT()|.
-const int kGlobalArray[5] = { 1, 2, 3, 4, 5 };
-MOJO_COMPILE_ASSERT(MOJO_ARRAYSIZE(kGlobalArray) == 5u,
- mojo_array_size_failed_in_compile_assert);
-
-TEST(MacrosTest, ArraySize) {
- double local_array[4] = { 6.7, 7.8, 8.9, 9.0 };
- EXPECT_EQ(4u, MOJO_ARRAYSIZE(local_array));
-}
-
-TEST(MacrosTest, MoveOnlyTypeForCpp03) {
- class MoveOnlyInt {
- MOJO_MOVE_ONLY_TYPE_FOR_CPP_03(MoveOnlyInt, RValue)
-
- public:
- MoveOnlyInt() : is_set_(false), value_() {}
- explicit MoveOnlyInt(int value) : is_set_(true), value_(value) {}
- ~MoveOnlyInt() {}
-
- // Move-only constructor and operator=.
- MoveOnlyInt(RValue other) { *this = other; }
- MoveOnlyInt& operator=(RValue other) {
- if (other.object != this) {
- is_set_ = other.object->is_set_;
- value_ = other.object->value_;
- other.object->is_set_ = false;
- }
- return *this;
- }
-
- int value() const {
- assert(is_set());
- return value_;
- }
- bool is_set() const { return is_set_; }
-
- private:
- bool is_set_;
- int value_;
- };
-
- MoveOnlyInt x(123);
- EXPECT_TRUE(x.is_set());
- EXPECT_EQ(123, x.value());
- MoveOnlyInt y;
- EXPECT_FALSE(y.is_set());
- y = x.Pass();
- EXPECT_FALSE(x.is_set());
- EXPECT_TRUE(y.is_set());
- EXPECT_EQ(123, y.value());
- MoveOnlyInt z(y.Pass());
- EXPECT_FALSE(y.is_set());
- EXPECT_TRUE(z.is_set());
- EXPECT_EQ(123, z.value());
- z = z.Pass();
- EXPECT_TRUE(z.is_set());
- EXPECT_EQ(123, z.value());
-}
-
-} // namespace
-} // namespace mojo