M jasm/assemble/assembler_impl/functions_impl.cpp +2 -1
@@ 1553,8 1553,9 @@ void Assembler::function_json_read(bool
core::json::JsonType object;
parser.parse(object);
if (parser.parse_error()) {
+ error = "Failed to parse json. " + parser.parse_error_string();
const ExpressionComponent &ec = components[leftmost_node_in_expression(components, arg1)];
- report_error(ec.source_location, AssemblyErrorCodes::JsonParseError, parser.parse_error_string().c_str());
+ report_error(ec.source_location, AssemblyErrorCodes::JsonParseError, error.c_str());
set_unknown(result);
return;
}
A => jasm/unit_tests/broken.json +3 -0
@@ 0,0 1,3 @@
+{
+ "one" =
+}
No newline at end of file
A => jasm/unit_tests/results/test_json_import_missing_file.stdout +2 -0
@@ 0,0 1,2 @@
+unit_tests/test_json_import_missing_file.asm(3,21) : Error 3119 : Failed to find include file 'unit_tests/nonexisting.json'
+Assembly ended with errors.
A => jasm/unit_tests/results/test_json_import_parse_failure.stdout +2 -0
@@ 0,0 1,2 @@
+unit_tests/test_json_import_parse_failure.asm(3,21) : Error 3120 : Failed to parse json. Expected value. (line 3, column 1)
+Assembly ended with errors.
A => jasm/unit_tests/results/test_json_import_with_numeric_argument.stdout +2 -0
@@ 0,0 1,2 @@
+unit_tests/test_json_import_with_numeric_argument.asm(3,21) : Error 3048 : Function needs string expression argument but got integer.
+Assembly ended with errors.
A => jasm/unit_tests/test_json_import_missing_file.asm +8 -0
@@ 0,0 1,8 @@
+// assembler command line arguments: 6502 [-v0]
+
+const a = json_read("unit_tests/nonexisting.json")
+
+section code, "main", 0
+{
+ define byte[] = {"FAIL"}
+}
A => jasm/unit_tests/test_json_import_parse_failure.asm +8 -0
@@ 0,0 1,8 @@
+// assembler command line arguments: 6502 [-v0]
+
+const a = json_read("unit_tests/broken.json")
+
+section code, "main", 0
+{
+ define byte[] = {"FAIL"}
+}
A => jasm/unit_tests/test_json_import_with_numeric_argument.asm +8 -0
@@ 0,0 1,8 @@
+// assembler command line arguments: 6502 [-v0]
+
+const a = json_read(0)
+
+section code, "main", 0
+{
+ define byte[] = {"FAIL"}
+}