11/*
2- * Licensed to the Apache Software Foundation (ASF) under one
2+ * Licensed to the Apache Software Foundation (ASF) under one
33 * or more contributor license agreements. See the NOTICE file
44 * distributed with this work for additional information
55 * regarding copyright ownership. The ASF licenses this file
1919
2020#pragma once
2121
22+ #include " table_test_helper.h"
23+
2224#include < filesystem>
2325#include < fstream>
2426#include < optional>
3032
3133#include " iceberg/json_internal.h"
3234#include " iceberg/test/test_config.h"
33- #include " table_test_helper.h"
3435
3536namespace iceberg {
3637
37- std::string TableTestHelper::GetResourcePath (const std::string& file_name) {
38- return std::string (ICEBERG_TEST_RESOURCES) + " /" + file_name;
39- }
38+ std::string TableTestHelper::GetResourcePath (const std::string& file_name) {
39+ return std::string (ICEBERG_TEST_RESOURCES) + " /" + file_name;
40+ }
4041
41- void TableTestHelper::ReadJsonFile (const std::string& file_name, std::string* content) {
42- std::filesystem::path path{GetResourcePath (file_name)};
43- ASSERT_TRUE (std::filesystem::exists (path))
44- << " File does not exist: " << path.string ();
42+ void TableTestHelper::ReadJsonFile (const std::string& file_name, std::string* content) {
43+ std::filesystem::path path{GetResourcePath (file_name)};
44+ ASSERT_TRUE (std::filesystem::exists (path)) << " File does not exist: " << path.string ();
4545
46- std::ifstream file (path);
47- std::stringstream buffer;
48- buffer << file.rdbuf ();
49- *content = buffer.str ();
50- }
46+ std::ifstream file (path);
47+ std::stringstream buffer;
48+ buffer << file.rdbuf ();
49+ *content = buffer.str ();
50+ }
5151
52- void TableTestHelper::ReadTableMetadata (const std::string& file_name,
53- std::unique_ptr<TableMetadata>* metadata) {
54- std::string json_content;
55- ReadJsonFile (file_name, &json_content);
52+ void TableTestHelper::ReadTableMetadata (const std::string& file_name,
53+ std::unique_ptr<TableMetadata>* metadata) {
54+ std::string json_content;
55+ ReadJsonFile (file_name, &json_content);
5656
57- nlohmann::json json = nlohmann::json::parse (json_content);
58- auto result = TableMetadataFromJson (json);
59- ASSERT_TRUE (result.has_value ()) << " Failed to parse table metadata from " << file_name
60- << " : " << result.error ().message ;
61- *metadata = std::move (result.value ());
62- }
57+ nlohmann::json json = nlohmann::json::parse (json_content);
58+ auto result = TableMetadataFromJson (json);
59+ ASSERT_TRUE (result.has_value ()) << " Failed to parse table metadata from " << file_name
60+ << " : " << result.error ().message ;
61+ *metadata = std::move (result.value ());
62+ }
6363
64- } // namespace
64+ } // namespace iceberg
0 commit comments