Ninja
status_test.cc
Go to the documentation of this file.
1 // Copyright 2011 Google Inc. All Rights Reserved.
2 //
3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at
6 //
7 // http://www.apache.org/licenses/LICENSE-2.0
8 //
9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS,
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and
13 // limitations under the License.
14 
15 #include "status.h"
16 
17 #include "test.h"
18 
19 TEST(StatusTest, StatusFormatElapsed) {
20  BuildConfig config;
21  StatusPrinter status(config);
22 
23  status.BuildStarted();
24  // Before any task is done, the elapsed time must be zero.
25  EXPECT_EQ("[%/e0.000]",
26  status.FormatProgressStatus("[%%/e%e]", 0));
27 }
28 
29 TEST(StatusTest, StatusFormatReplacePlaceholder) {
30  BuildConfig config;
31  StatusPrinter status(config);
32 
33  EXPECT_EQ("[%/s0/t0/r0/u0/f0]",
34  status.FormatProgressStatus("[%%/s%s/t%t/r%r/u%u/f%f]", 0));
35 }
Implementation of the Status interface that prints the status as human-readable strings to stdout...
Definition: status.h:44
#define EXPECT_EQ(a, b)
Definition: test.h:64
virtual void BuildStarted()
Definition: status.cc:137
std::string FormatProgressStatus(const char *progress_status_format, int64_t time_millis) const
Format the progress status string by replacing the placeholders.
Definition: status.cc:148
Options (e.g. verbosity, parallelism) passed to a build.
Definition: build.h:157
TEST(StatusTest, StatusFormatElapsed)
Definition: status_test.cc:19