1// Copyright 2014 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 9namespace crazy { 10 11TEST(Error, ConstructEmpty) { 12 Error error; 13 EXPECT_STREQ("", error.c_str()); 14} 15 16TEST(Error, ConstructWithString) { 17 Error error("Foo Bar"); 18 EXPECT_STREQ("Foo Bar", error.c_str()); 19} 20 21TEST(Error, CopyConstructor) { 22 Error error("FooFoo"); 23 Error error2(error); 24 25 EXPECT_STREQ("FooFoo", error2.c_str()); 26} 27 28TEST(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 36TEST(Error, Append) { 37 Error error("Foo"); 38 error.Append("Bar"); 39 EXPECT_STREQ("FooBar", error.c_str()); 40} 41 42TEST(Error, Format) { 43 Error error; 44 error.Format("%s %s!", "Hi", "Cowboy"); 45 EXPECT_STREQ("Hi Cowboy!", error.c_str()); 46} 47 48TEST(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