@@ -8,8 +8,8 @@ const no_jq = os.getenv('VNO_JQ') == '1'
88
99// Instructions for developers:
1010// The actual tests and data can be obtained by doing:
11- // `git clone -n https://github.com/toml-rs/toml.git vlib/toml/tests/testdata/alexcrichton `
12- // `git -C vlib/toml/tests/testdata/alexcrichton reset --hard 499e8c4`
11+ // `git clone -n https://github.com/toml-rs/toml.git vlib/toml/tests/testdata/toml_rs `
12+ // `git -C vlib/toml/tests/testdata/toml_rs reset --hard 499e8c4`
1313// See also the CI toml tests
1414// Kept for easier handling of future updates to the tests
1515const valid_exceptions = [
@@ -38,7 +38,7 @@ const use_type_2_arrays = [
3838]
3939const tests_folder = os.join_path ('test-suite' , 'tests' )
4040const jq = os.find_abs_path_of_executable ('jq' ) or { '' }
41- const compare_work_dir_root = os.join_path (os.vtmp_dir (), 'toml_alexcrichton ' )
41+ const compare_work_dir_root = os.join_path (os.vtmp_dir (), 'toml_toml_rs ' )
4242// From: https://stackoverflow.com/a/38266731/1904615
4343const jq_normalize = r '# Apply f to composite entities recursively using keys[], and to atoms
4444def sorted_walk(f):
@@ -62,10 +62,10 @@ fn run(args []string) !string {
6262 return res.output
6363}
6464
65- // test_alexcrichton_toml_rs run though 'testdata/alexcrichton /toml-test/test-suite/tests/*' if found.
66- fn test_alexcrichton_toml_rs () {
65+ // test_toml_rs_toml_rs run though 'testdata/toml_rs /toml-test/test-suite/tests/*' if found.
66+ fn test_toml_rs_toml_rs () {
6767 eprintln ('> running ${@LOCATION }' )
68- test_root := '${@VROOT }/vlib/toml/tests/testdata/alexcrichton /test-suite/tests'
68+ test_root := '${@VROOT }/vlib/toml/tests/testdata/toml_rs /test-suite/tests'
6969 if os.is_dir (test_root) {
7070 valid_test_files := os.walk_ext (os.join_path (test_root, 'valid' ), '.toml' )
7171 invalid_test_files := os.walk_ext (os.join_path (test_root, 'invalid' ), '.toml' )
@@ -139,31 +139,31 @@ fn test_alexcrichton_toml_rs() {
139139
140140 v_toml_json_path := os.join_path (compare_work_dir_root,
141141 os.file_name (valid_test_file).all_before_last ('.' ) + '.v.json' )
142- alexcrichton_toml_json_path := os.join_path (compare_work_dir_root,
142+ toml_rs_toml_json_path := os.join_path (compare_work_dir_root,
143143 os.file_name (valid_test_file).all_before_last ('.' ) + '.json' )
144144
145145 mut array_type := 1
146146 if relative in use_type_2_ arrays {
147147 array_type = 2
148148 }
149149
150- os.write_file (v_toml_json_path, to_alexcrichton (toml_doc.ast.table, array_type))!
150+ os.write_file (v_toml_json_path, to_toml_rs (toml_doc.ast.table, array_type))!
151151
152- alexcrichton_json := os.read_file (valid_test_file.all_before_last ('.' ) + '.json' )!
152+ toml_rs_json := os.read_file (valid_test_file.all_before_last ('.' ) + '.json' )!
153153
154- os.write_file (alexcrichton_toml_json_path, alexcrichton_json )!
154+ os.write_file (toml_rs_toml_json_path, toml_rs_json )!
155155
156156 v_normalized_json := run ([jq, '-S' , '-f "${jq_normalize_path }"' , v_toml_json_path]) or {
157157 contents := os.read_file (v_toml_json_path)!
158158 panic (err.msg () + '\n ${contents }' )
159159 }
160- alexcrichton_normalized_json := run ([jq, '-S' , '-f "${jq_normalize_path }"' ,
161- alexcrichton_toml_json_path ]) or {
160+ toml_rs_normalized_json := run ([jq, '-S' , '-f "${jq_normalize_path }"' ,
161+ toml_rs_toml_json_path ]) or {
162162 contents := os.read_file (v_toml_json_path)!
163163 panic (err.msg () + '\n ${contents }' )
164164 }
165165
166- assert alexcrichton_normalized_json == v_normalized_json
166+ assert toml_rs_normalized_json == v_normalized_json
167167
168168 valid++
169169 }
@@ -213,8 +213,8 @@ fn test_alexcrichton_toml_rs() {
213213 }
214214}
215215
216- // to_alexcrichton_time
217- fn to_alexcrichton_time (time_str string ) string {
216+ // to_toml_rs_time
217+ fn to_toml_rs_time (time_str string ) string {
218218 if time_str.contains ('.' ) {
219219 date_and_time := time_str.all_before ('.' )
220220 mut ms := time_str.all_after ('.' )
@@ -229,8 +229,8 @@ fn to_alexcrichton_time(time_str string) string {
229229 }
230230}
231231
232- // to_alexcrichton returns an alexcrichton compatible json string converted from the `value` ast.Value.
233- fn to_alexcrichton (value ast.Value, array_type int ) string {
232+ // to_toml_rs returns an toml_rs compatible json string converted from the `value` ast.Value.
233+ fn to_toml_rs (value ast.Value, array_type int ) string {
234234 match value {
235235 ast.Quoted {
236236 json_text := json2 .Any (value.text).json_str ()
@@ -248,9 +248,9 @@ fn to_alexcrichton(value ast.Value, array_type int) string {
248248 }
249249 // NOTE test suite inconsistency.
250250 // It seems it's implementation specific how time and
251- // date-time values are represented in detail. For now we follow the BurntSushi format
251+ // date-time values are represented in detail. For now we follow the toml-lang format
252252 // that expands to 6 digits which is also a valid RFC 3339 representation.
253- json_text = to_alexcrichton_time (json_text[1 ..json_text.len - 1 ])
253+ json_text = to_toml_rs_time (json_text[1 ..json_text.len - 1 ])
254254 return '{ "type": "${typ }", "value": "${json_text }" }'
255255 }
256256 ast.Date {
@@ -259,7 +259,7 @@ fn to_alexcrichton(value ast.Value, array_type int) string {
259259 }
260260 ast.Time {
261261 mut json_text := json2 .Any (value.text).json_str ()
262- json_text = to_alexcrichton_time (json_text[1 ..json_text.len - 1 ])
262+ json_text = to_toml_rs_time (json_text[1 ..json_text.len - 1 ])
263263 return '{ "type": "time", "value": "${json_text }" }'
264264 }
265265 ast.Bool {
@@ -295,7 +295,7 @@ fn to_alexcrichton(value ast.Value, array_type int) string {
295295 mut str := '{ '
296296 for key, val in value {
297297 json_key := json2 .Any (key).json_str ()
298- str + = ' ${json_key }: ${to_alexcrichton (val , array_type )},'
298+ str + = ' ${json_key }: ${to_toml_rs (val , array_type )},'
299299 }
300300 str = str.trim_right (',' )
301301 str + = ' }'
@@ -309,7 +309,7 @@ fn to_alexcrichton(value ast.Value, array_type int) string {
309309 str = '[ '
310310 }
311311 for val in value {
312- str + = ' ${to_alexcrichton (val , array_type )},'
312+ str + = ' ${to_toml_rs (val , array_type )},'
313313 }
314314 str = str.trim_right (',' )
315315 if array_type == 1 {
0 commit comments