git.delta.rocks / jrsonnet / refs/commits / 7a97aae0523c

difftreelog

feat enable native go-testdata tests

lplruuvvYaroslav Bolyukin2026-07-31parent: #0efc2e4.patch.diff
in: master

4 files changed

modifiedtests/go_testdata_golden_override/native4.jsonnet.goldendiffbeforeafterboth
1only functions can be called, got null1runtime error: xxx
2 native4.jsonnet:1:28-32: error statement
3 argument <x> evaluation
4 native4.jsonnet:1:27-39: function <json_to_string> call
modifiedtests/go_testdata_golden_override/native5.jsonnet.goldendiffbeforeafterboth
1only functions can be called, got null1runtime error: tried to manifest function
2 native5.jsonnet:1:27-41: function <json_to_string> call
modifiedtests/go_testdata_golden_override/native7.jsonnet.goldendiffbeforeafterboth
1only functions can be called, got null1parameter y is not defined
2 native7.jsonnet:1:27-32: function <json_to_string> preparation
modifiedtests/tests/cpp_test_suite.rsdiffbeforeafterboth
5};5};
66
7use jrsonnet_evaluator::{7use jrsonnet_evaluator::{
8 FileImportResolver, IStr, ObjValueBuilder, State, Val, apply_tla,8 FileImportResolver, IStr, ObjValueBuilder, Result, State, Val, apply_tla,
9 function::builtin,
9 gc::WithCapacityExt as _,10 gc::WithCapacityExt as _,
10 manifest::JsonFormat,11 manifest::JsonFormat,
11 rustc_hash::FxHashMap,12 rustc_hash::FxHashMap,
18mod common;19mod common;
19use common::ContextInitializer as TestContextInitializer;20use common::ContextInitializer as TestContextInitializer;
21
22#[builtin]
23fn json_to_string(x: Val) -> Result<String> {
24 x.manifest(JsonFormat::minify(
25 #[cfg(feature = "exp-preserve-order")]
26 false,
27 ))
28}
2029
21fn run(file: &Path, root: &Path) -> String {30fn run(file: &Path, root: &Path) -> String {
22 let mut s = State::builder();31 let mut s = State::builder();
30 .expect("code is valid");39 .expect("code is valid");
3140
32 // Golang test suite41 // Golang test suite
42 std_context.add_native("jsonToString", json_to_string {});
33 std_context43 std_context
34 .add_ext_code("codeVar", "3+3")44 .add_ext_code("codeVar", "3+3")
35 .expect("code is valid");45 .expect("code is valid");
147 "multi_no_newline.jsonnet",157 "multi_no_newline.jsonnet",
148 "multi_no_newline_string_output.jsonnet",158 "multi_no_newline_string_output.jsonnet",
149 "multi_string_output.jsonnet",159 "multi_string_output.jsonnet",
150 // Tested otherwise
151 "native1.jsonnet",
152 "native2.jsonnet",
153 "native3.jsonnet",
154 "native6.jsonnet",
155 // Golang fails with max stack frames exceeded error160 // Golang fails with max stack frames exceeded error
156 "std.makeArray_recursive_evalutation_order_matters.jsonnet",161 "std.makeArray_recursive_evalutation_order_matters.jsonnet",
157 // Tailstrict semantics is partially unspecified162 // Tailstrict semantics is partially unspecified