// Copyright 2018 The Fuchsia Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #include #include #include #include #include #include "test_library.h" namespace { // Test that an invalid compound identifier fails parsing. Regression // test for FIDL-263. bool bad_compound_identifier_test() { BEGIN_TEST; // The leading 0 in the library name causes parsing an Identifier // to fail, and then parsing a CompoundIdentifier to fail. TestLibrary library("bad_compound_identifier.fidl", R"FIDL( library 0fidl.test.badcompoundidentifier; )FIDL"); EXPECT_FALSE(library.Compile()); auto errors = library.errors(); ASSERT_EQ(errors.size(), 1); ASSERT_STR_STR(errors[0].c_str(), "unexpected token"); END_TEST; } } // namespace BEGIN_TEST_CASE(bad_compound_identifier_test_tests); RUN_TEST(bad_compound_identifier_test); END_TEST_CASE(bad_compound_identifier_test_tests);