mirror of
https://github.com/google/sandboxed-api.git
synced 2024-03-22 13:11:30 +08:00
Google style added
This commit is contained in:
parent
e411799d0d
commit
bfa6b2502b
|
@ -89,7 +89,8 @@ namespace {
|
||||||
constexpr char kInputFile[] = "yaml_stream_example.jsonnet";
|
constexpr char kInputFile[] = "yaml_stream_example.jsonnet";
|
||||||
constexpr char kOutputFile[] = "yaml_stream_example.yaml";
|
constexpr char kOutputFile[] = "yaml_stream_example.yaml";
|
||||||
constexpr char kOutputToRead[] = "tests_output/yaml_stream_example.yaml";
|
constexpr char kOutputToRead[] = "tests_output/yaml_stream_example.yaml";
|
||||||
constexpr char kOutputToExpect[] = "tests_expected_output/yaml_stream_example.yaml";
|
constexpr char kOutputToExpect[] =
|
||||||
|
"tests_expected_output/yaml_stream_example.yaml";
|
||||||
|
|
||||||
Read_input(kInputFile);
|
Read_input(kInputFile);
|
||||||
Evaluate_jsonnet_code(kYamlStream, true);
|
Evaluate_jsonnet_code(kYamlStream, true);
|
||||||
|
|
|
@ -21,15 +21,17 @@ void JsonnetTestHelper::TestSetUp() {
|
||||||
int error = readlink("/proc/self/exe", buffer, 256);
|
int error = readlink("/proc/self/exe", buffer, 256);
|
||||||
ASSERT_GE(error, 0);
|
ASSERT_GE(error, 0);
|
||||||
|
|
||||||
std::pair<absl::string_view, absl::string_view> parts_of_path = sandbox2::file::SplitPath(buffer);
|
std::pair<absl::string_view, absl::string_view> parts_of_path =
|
||||||
|
sandbox2::file::SplitPath(buffer);
|
||||||
absl::string_view binary_path = parts_of_path.first;
|
absl::string_view binary_path = parts_of_path.first;
|
||||||
|
|
||||||
std::string input_path = sandbox2::file::JoinPath(binary_path, "tests_input", "dummy_input");
|
std::string input_path =
|
||||||
std::string output_path = sandbox2::file::JoinPath(binary_path, "tests_output", "dummy_input");
|
sandbox2::file::JoinPath(binary_path, "tests_input", "dummy_input");
|
||||||
|
std::string output_path =
|
||||||
|
sandbox2::file::JoinPath(binary_path, "tests_output", "dummy_input");
|
||||||
|
|
||||||
// Set up sandbox and api.
|
// Set up sandbox and api.
|
||||||
sandbox_ = absl::make_unique<JsonnetBaseSandbox>(input_path,
|
sandbox_ = absl::make_unique<JsonnetBaseSandbox>(input_path, output_path);
|
||||||
output_path);
|
|
||||||
ASSERT_THAT(sandbox_->Init(), sapi::IsOk());
|
ASSERT_THAT(sandbox_->Init(), sapi::IsOk());
|
||||||
api_ = absl::make_unique<JsonnetApi>(sandbox_.get());
|
api_ = absl::make_unique<JsonnetApi>(sandbox_.get());
|
||||||
|
|
||||||
|
@ -118,7 +120,8 @@ void JsonnetTestHelper::Write_output(const char* filename_or_directory,
|
||||||
|
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case kBase: {
|
case kBase: {
|
||||||
std::string out_file_in_sandboxee(std::string("/output/") +
|
std::string out_file_in_sandboxee(
|
||||||
|
std::string("/output/") +
|
||||||
basename(const_cast<char*>(&filename_or_directory[0])));
|
basename(const_cast<char*>(&filename_or_directory[0])));
|
||||||
sapi::v::ConstCStr out_file_var(out_file_in_sandboxee.c_str());
|
sapi::v::ConstCStr out_file_var(out_file_in_sandboxee.c_str());
|
||||||
|
|
||||||
|
@ -137,7 +140,8 @@ void JsonnetTestHelper::Write_output(const char* filename_or_directory,
|
||||||
}
|
}
|
||||||
|
|
||||||
case kYamlStream: {
|
case kYamlStream: {
|
||||||
std::string out_file_in_sandboxee(std::string("/output/") +
|
std::string out_file_in_sandboxee(
|
||||||
|
std::string("/output/") +
|
||||||
basename(const_cast<char*>(&filename_or_directory[0])));
|
basename(const_cast<char*>(&filename_or_directory[0])));
|
||||||
sapi::v::ConstCStr out_file_var(out_file_in_sandboxee.c_str());
|
sapi::v::ConstCStr out_file_var(out_file_in_sandboxee.c_str());
|
||||||
SAPI_ASSERT_OK_AND_ASSIGN(
|
SAPI_ASSERT_OK_AND_ASSIGN(
|
||||||
|
|
Loading…
Reference in New Issue
Block a user