|
Packit |
bd1cd8 |
// Copyright 2008, Google Inc.
|
|
Packit |
bd1cd8 |
// All rights reserved.
|
|
Packit |
bd1cd8 |
//
|
|
Packit |
bd1cd8 |
// Redistribution and use in source and binary forms, with or without
|
|
Packit |
bd1cd8 |
// modification, are permitted provided that the following conditions are
|
|
Packit |
bd1cd8 |
// met:
|
|
Packit |
bd1cd8 |
//
|
|
Packit |
bd1cd8 |
// * Redistributions of source code must retain the above copyright
|
|
Packit |
bd1cd8 |
// notice, this list of conditions and the following disclaimer.
|
|
Packit |
bd1cd8 |
// * Redistributions in binary form must reproduce the above
|
|
Packit |
bd1cd8 |
// copyright notice, this list of conditions and the following disclaimer
|
|
Packit |
bd1cd8 |
// in the documentation and/or other materials provided with the
|
|
Packit |
bd1cd8 |
// distribution.
|
|
Packit |
bd1cd8 |
// * Neither the name of Google Inc. nor the names of its
|
|
Packit |
bd1cd8 |
// contributors may be used to endorse or promote products derived from
|
|
Packit |
bd1cd8 |
// this software without specific prior written permission.
|
|
Packit |
bd1cd8 |
//
|
|
Packit |
bd1cd8 |
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
|
Packit |
bd1cd8 |
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
|
Packit |
bd1cd8 |
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
|
Packit |
bd1cd8 |
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
|
Packit |
bd1cd8 |
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
|
Packit |
bd1cd8 |
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
|
Packit |
bd1cd8 |
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
|
Packit |
bd1cd8 |
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
|
Packit |
bd1cd8 |
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
Packit |
bd1cd8 |
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
Packit |
bd1cd8 |
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
Packit |
bd1cd8 |
//
|
|
Packit |
bd1cd8 |
// Author: wan@google.com (Zhanyong Wan)
|
|
Packit |
bd1cd8 |
|
|
Packit |
bd1cd8 |
// A helper program for testing how Google Test determines whether to use
|
|
Packit |
bd1cd8 |
// colors in the output. It prints "YES" and returns 1 if Google Test
|
|
Packit |
bd1cd8 |
// decides to use colors, and prints "NO" and returns 0 otherwise.
|
|
Packit |
bd1cd8 |
|
|
Packit |
bd1cd8 |
#include <stdio.h>
|
|
Packit |
bd1cd8 |
|
|
Packit |
bd1cd8 |
#include "gtest/gtest.h"
|
|
Packit |
bd1cd8 |
|
|
Packit |
bd1cd8 |
// Indicates that this translation unit is part of Google Test's
|
|
Packit |
bd1cd8 |
// implementation. It must come before gtest-internal-inl.h is
|
|
Packit |
bd1cd8 |
// included, or there will be a compiler error. This trick is to
|
|
Packit |
bd1cd8 |
// prevent a user from accidentally including gtest-internal-inl.h in
|
|
Packit |
bd1cd8 |
// his code.
|
|
Packit |
bd1cd8 |
#define GTEST_IMPLEMENTATION_ 1
|
|
Packit |
bd1cd8 |
#include "src/gtest-internal-inl.h"
|
|
Packit |
bd1cd8 |
#undef GTEST_IMPLEMENTATION_
|
|
Packit |
bd1cd8 |
|
|
Packit |
bd1cd8 |
using testing::internal::ShouldUseColor;
|
|
Packit |
bd1cd8 |
|
|
Packit |
bd1cd8 |
// The purpose of this is to ensure that the UnitTest singleton is
|
|
Packit |
bd1cd8 |
// created before main() is entered, and thus that ShouldUseColor()
|
|
Packit |
bd1cd8 |
// works the same way as in a real Google-Test-based test. We don't actual
|
|
Packit |
bd1cd8 |
// run the TEST itself.
|
|
Packit |
bd1cd8 |
TEST(GTestColorTest, Dummy) {
|
|
Packit |
bd1cd8 |
}
|
|
Packit |
bd1cd8 |
|
|
Packit |
bd1cd8 |
int main(int argc, char** argv) {
|
|
Packit |
bd1cd8 |
testing::InitGoogleTest(&argc, argv);
|
|
Packit |
bd1cd8 |
|
|
Packit |
bd1cd8 |
if (ShouldUseColor(true)) {
|
|
Packit |
bd1cd8 |
// Google Test decides to use colors in the output (assuming it
|
|
Packit |
bd1cd8 |
// goes to a TTY).
|
|
Packit |
bd1cd8 |
printf("YES\n");
|
|
Packit |
bd1cd8 |
return 1;
|
|
Packit |
bd1cd8 |
} else {
|
|
Packit |
bd1cd8 |
// Google Test decides not to use colors in the output.
|
|
Packit |
bd1cd8 |
printf("NO\n");
|
|
Packit |
bd1cd8 |
return 0;
|
|
Packit |
bd1cd8 |
}
|
|
Packit |
bd1cd8 |
}
|