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

Side by Side Diff: tools/clang/empty_string/tests/test-original.cc

Issue 12746010: Implement clang tool that converts std::string("") to std::string(). (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Add copyright boilerplate to test files. Yay. Created 7 years, 8 months 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
OLDNEW
(Empty)
1 // Copyright (c) 2013 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 // Test file for the empty string clang tool.
6
7 #include <string>
8
9 // Tests for std::string declarations.
10 void TestDeclarations() { std::string a(""), b("abc"), c(""); }
11
12 // Tests for std::string allocated with new.
13 void TestNew() {
14 std::string* a = new std::string(""),
15 *b = new std::string("abc"),
16 *c = new std::string(""),
17 *d = new std::string();
18 }
19
20 // Tests for std::string construction in initializer lists.
21 class TestInitializers {
22 public:
23 TestInitializers() : a("") {}
24 TestInitializers(bool) : a(""), b("") {}
25 TestInitializers(double) : a(""), b("cat"), c() {}
26
27 private:
28 std::string a;
29 std::string b;
30 std::string c;
31 };
32
33 // Tests for temporary std::strings.
34 void TestTemporaries(const std::string& reference_argument,
35 const std::string value_argument) {
36 TestTemporaries("", "");
37 TestTemporaries(std::string(""), std::string(""));
38 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698