/** * Copyright © 2024 IBM Corporation * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #include "config_file_parser_error.hpp" #include #include using namespace phosphor::power::sequencer; TEST(ConfigFileParserErrorTests, Constructor) { std::filesystem::path pathName{ "/usr/share/phosphor-power-sequencer/foo.json"}; ConfigFileParserError error{pathName, "Required property missing"}; EXPECT_EQ(error.getPathName(), pathName); EXPECT_STREQ( error.what(), "ConfigFileParserError: /usr/share/phosphor-power-sequencer/foo.json: " "Required property missing"); } TEST(ConfigFileParserErrorTests, GetPathName) { std::filesystem::path pathName{ "/usr/share/phosphor-power-sequencer/bar.json"}; ConfigFileParserError error{pathName, "Required property missing"}; EXPECT_EQ(error.getPathName(), pathName); } TEST(ConfigFileParserErrorTests, What) { std::filesystem::path pathName{ "/usr/share/phosphor-power-sequencer/bar.json"}; ConfigFileParserError error{pathName, "Required property missing"}; EXPECT_STREQ( error.what(), "ConfigFileParserError: /usr/share/phosphor-power-sequencer/bar.json: " "Required property missing"); }