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/aos/json_to_flatbuffer_test.cc b/aos/json_to_flatbuffer_test.cc
index 6772826..fddb431 100644
--- a/aos/json_to_flatbuffer_test.cc
+++ b/aos/json_to_flatbuffer_test.cc
@@ -1,5 +1,6 @@
#include "aos/json_to_flatbuffer.h"
+#include "aos/flatbuffer_merge.h"
#include "aos/json_to_flatbuffer_generated.h"
#include "aos/testing/path.h"
#include "flatbuffers/minireflect.h"
@@ -301,5 +302,20 @@
ConfigurationTypeTable()));
}
+TEST_F(JsonToFlatbufferTest, SpacedData) {
+ EXPECT_TRUE(CompareFlatBuffer(
+ FlatbufferDetachedBuffer<VectorOfStrings>(
+ JsonToFlatbuffer<VectorOfStrings>(R"json({
+ "str": [
+ "f o o",
+ "b a r",
+ "foo bar",
+ "bar foo"
+ ]
+})json")),
+ JsonFileToFlatbuffer<VectorOfStrings>(
+ ArtifactPath("aos/json_to_flatbuffer_test_spaces.json"))));
+}
+
} // namespace testing
} // namespace aos