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 #include "crazy_linker_error.h"
6
7 #include <minitest/minitest.h>
8
9 namespace crazy {
10
TEST(Error,ConstructEmpty)11 TEST(Error, ConstructEmpty) {
12 Error error;
13 EXPECT_STREQ("", error.c_str());
14 }
15
TEST(Error,ConstructWithString)16 TEST(Error, ConstructWithString) {
17 Error error("Foo Bar");
18 EXPECT_STREQ("Foo Bar", error.c_str());
19 }
20
TEST(Error,CopyConstructor)21 TEST(Error, CopyConstructor) {
22 Error error("FooFoo");
23 Error error2(error);
24
25 EXPECT_STREQ("FooFoo", error2.c_str());
26 }
27
TEST(Error,Set)28 TEST(Error, Set) {
29 Error error;
30 error.Set("BarFoo");
31 EXPECT_STREQ("BarFoo", error.c_str());
32 error.Set("FooBar");
33 EXPECT_STREQ("FooBar", error.c_str());
34 }
35
TEST(Error,Append)36 TEST(Error, Append) {
37 Error error("Foo");
38 error.Append("Bar");
39 EXPECT_STREQ("FooBar", error.c_str());
40 }
41
TEST(Error,Format)42 TEST(Error, Format) {
43 Error error;
44 error.Format("%s %s!", "Hi", "Cowboy");
45 EXPECT_STREQ("Hi Cowboy!", error.c_str());
46 }
47
TEST(Error,AppendFormat)48 TEST(Error, AppendFormat) {
49 Error error("Hi");
50 error.AppendFormat(" there %s!", "Cowboy");
51 EXPECT_STREQ("Hi there Cowboy!", error.c_str());
52 }
53
54 } // namespace crazy
55