63 {
64 auto data_dir =
fc::path(bfs::temp_directory_path());
65 auto good_json = std::string("{\"version\" : \"test string please ignore\"}");
66 auto good_json_filename = create_temp_file(good_json);
67 auto relative_json_filename = bfs::path(good_json_filename).filename().generic_string();
68
69 auto good_abi = chain::abi_def();
70 good_abi.version = "test string please ignore";
71
72 auto bad_json = std::string("{{\"version\":oops\"}");
73 auto bad_json_filename = create_temp_file(bad_json);
74 auto bad_filename = (bfs::temp_directory_path() / bfs::unique_path()).generic_string();
75 auto directory_name = bfs::temp_directory_path().generic_string();
76
77
80
81
82 BOOST_REQUIRE_THROW(
abi_def_from_file(bad_json_filename, data_dir), chain::json_parse_exception );
83 BOOST_REQUIRE_THROW(
abi_def_from_file(bad_filename, data_dir), chain::plugin_config_exception );
84 BOOST_REQUIRE_THROW(
abi_def_from_file(directory_name, data_dir), chain::plugin_config_exception );
85 }
wraps boost::filesystem::path to provide platform independent path manipulation.
chain::abi_def abi_def_from_file(const std::string &file_name, const fc::path &data_dir)