Fix issues with json files
File parsing no longer uses istream, which strips whitespace. Moved hard-coded json to its own file.
Signed-off-by: Alexander Yee <xander.yee@gmail.com>
Change-Id: I342b74fd1cc8c5af7721af5955aa7d7b185ac71e
diff --git a/frc971/constants/BUILD b/frc971/constants/BUILD
index c17dc31..3a7e73a 100644
--- a/frc971/constants/BUILD
+++ b/frc971/constants/BUILD
@@ -45,6 +45,7 @@
],
data = [
"//frc971/constants/testdata:aos_config",
+ "//frc971/constants/testdata:syntax_error.json",
"//frc971/constants/testdata:test_constants.json",
],
target_compatible_with = ["@platforms//os:linux"],
diff --git a/frc971/constants/constants_sender_test.cc b/frc971/constants/constants_sender_test.cc
index 1441767..512cb68 100644
--- a/frc971/constants/constants_sender_test.cc
+++ b/frc971/constants/constants_sender_test.cc
@@ -113,11 +113,11 @@
({
ConstantSender<testdata::ConstantsData, testdata::ConstantsList>
test_syntax(constants_sender_event_loop_.get(),
- "frc971/constants/testdata/syntaxerror.json", 971,
+ "frc971/constants/testdata/syntax_error.json", 971,
"/constants");
event_loop_factory_.RunFor(std::chrono::seconds(1));
}),
- "Error on line 0");
+ "Invalid field name");
}
} // namespace testing
diff --git a/frc971/constants/testdata/BUILD b/frc971/constants/testdata/BUILD
index 04cf8d3..a20264c 100644
--- a/frc971/constants/testdata/BUILD
+++ b/frc971/constants/testdata/BUILD
@@ -1,7 +1,10 @@
load("//aos:config.bzl", "aos_config")
load("@com_github_google_flatbuffers//:build_defs.bzl", "flatbuffer_cc_library")
-exports_files(["test_constants.json"])
+exports_files([
+ "test_constants.json",
+ "syntax_error.json",
+])
flatbuffer_cc_library(
name = "constants_list_fbs",