Add ICU message format support
[chromium-blink-merge.git] / tools / gn / functions_target_unittest.cc
bloba7a0de9ac2c63352ec19d0f411b6f10e2ff4e3fb
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.
5 #include "testing/gtest/include/gtest/gtest.h"
6 #include "tools/gn/scheduler.h"
7 #include "tools/gn/scope.h"
8 #include "tools/gn/test_with_scope.h"
11 // Checks that we find unused identifiers in targets.
12 TEST(FunctionsTarget, CheckUnused) {
13 Scheduler scheduler;
14 TestWithScope setup;
16 // The target generator needs a place to put the targets or it will fail.
17 Scope::ItemVector item_collector;
18 setup.scope()->set_item_collector(&item_collector);
20 // Test a good one first.
21 TestParseInput good_input(
22 "source_set(\"foo\") {\n"
23 "}\n");
24 ASSERT_FALSE(good_input.has_error());
25 Err err;
26 good_input.parsed()->Execute(setup.scope(), &err);
27 ASSERT_FALSE(err.has_error()) << err.message();
29 // Test a source set with an unused variable.
30 TestParseInput source_set_input(
31 "source_set(\"foo\") {\n"
32 " unused = 5\n"
33 "}\n");
34 ASSERT_FALSE(source_set_input.has_error());
35 err = Err();
36 source_set_input.parsed()->Execute(setup.scope(), &err);
37 ASSERT_TRUE(err.has_error());