Speculative fix for the white/stale tab issue on Windows.
[chromium-blink-merge.git] / base / stringize_macros_unittest.cc
blob8d92d538563e6eb88da8df9825f492e79c29eb54
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4 //
5 // Unit tests for stringize_macros.h
7 #include "base/stringize_macros.h"
9 #include "testing/gtest/include/gtest/gtest.h"
11 // Macros as per documentation in header file.
12 #define PREPROCESSOR_UTIL_UNITTEST_A FOO
13 #define PREPROCESSOR_UTIL_UNITTEST_B(x) myobj->FunctionCall(x)
14 #define PREPROCESSOR_UTIL_UNITTEST_C "foo"
16 TEST(StringizeTest, Ansi) {
17 EXPECT_STREQ(
18 "PREPROCESSOR_UTIL_UNITTEST_A",
19 STRINGIZE_NO_EXPANSION(PREPROCESSOR_UTIL_UNITTEST_A));
20 EXPECT_STREQ(
21 "PREPROCESSOR_UTIL_UNITTEST_B(y)",
22 STRINGIZE_NO_EXPANSION(PREPROCESSOR_UTIL_UNITTEST_B(y)));
23 EXPECT_STREQ(
24 "PREPROCESSOR_UTIL_UNITTEST_C",
25 STRINGIZE_NO_EXPANSION(PREPROCESSOR_UTIL_UNITTEST_C));
27 EXPECT_STREQ("FOO", STRINGIZE(PREPROCESSOR_UTIL_UNITTEST_A));
28 EXPECT_STREQ("myobj->FunctionCall(y)",
29 STRINGIZE(PREPROCESSOR_UTIL_UNITTEST_B(y)));
30 EXPECT_STREQ("\"foo\"", STRINGIZE(PREPROCESSOR_UTIL_UNITTEST_C));
33 #if defined(OS_WIN)
35 TEST(StringizeTest, Wide) {
36 EXPECT_STREQ(
37 L"PREPROCESSOR_UTIL_UNITTEST_A",
38 LSTRINGIZE_NO_EXPANSION(PREPROCESSOR_UTIL_UNITTEST_A));
39 EXPECT_STREQ(
40 L"PREPROCESSOR_UTIL_UNITTEST_B(y)",
41 LSTRINGIZE_NO_EXPANSION(PREPROCESSOR_UTIL_UNITTEST_B(y)));
42 EXPECT_STREQ(
43 L"PREPROCESSOR_UTIL_UNITTEST_C",
44 LSTRINGIZE_NO_EXPANSION(PREPROCESSOR_UTIL_UNITTEST_C));
46 EXPECT_STREQ(L"FOO", LSTRINGIZE(PREPROCESSOR_UTIL_UNITTEST_A));
47 EXPECT_STREQ(L"myobj->FunctionCall(y)",
48 LSTRINGIZE(PREPROCESSOR_UTIL_UNITTEST_B(y)));
49 EXPECT_STREQ(L"\"foo\"", LSTRINGIZE(PREPROCESSOR_UTIL_UNITTEST_C));
52 TEST(ToLStringTest, Main) {
53 EXPECT_STREQ(L"blat", TO_L_STRING_NO_EXPANSION("blat"));
55 EXPECT_STREQ(L"foo", TO_L_STRING(PREPROCESSOR_UTIL_UNITTEST_C));
56 EXPECT_STREQ(L"blat", TO_L_STRING("blat"));
59 #endif // defined(OS_WIN)