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

Side by Side Diff: base/stringize_macros_unittest.cc

Issue 5103001: Add shared macros for stringizing and converting ANSI string constants... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 10 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « base/stringize_macros.h ('k') | ceee/ie/common/ceee_module_util.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Property Changes:
Added: svn:eol-style
+ LF
OLDNEW
(Empty)
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
6
7 #include "base/stringize_macros.h"
8
9 #include "testing/gtest/include/gtest/gtest.h"
10
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"
15
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));
26
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));
31 }
32
33 #if defined(OS_WIN)
34
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));
45
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));
50 }
51
52 TEST(ToLStringTest, Main) {
53 EXPECT_STREQ(L"blat", TO_L_STRING_NO_EXPANSION("blat"));
54
55 EXPECT_STREQ(L"foo", TO_L_STRING(PREPROCESSOR_UTIL_UNITTEST_C));
56 EXPECT_STREQ(L"blat", TO_L_STRING("blat"));
57 }
58
59 #endif // defined(OS_WIN)
OLDNEW
« no previous file with comments | « base/stringize_macros.h ('k') | ceee/ie/common/ceee_module_util.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698