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
19TEST(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
29TEST(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}
36