From dcbeb588297fe79e5d39c56f9d27b3860ee777f4 Mon Sep 17 00:00:00 2001 From: Petri Lehtinen Date: Mon, 25 Mar 2024 19:01:14 +0200 Subject: [PATCH] Simplify tests even more Drop the useless `export` lines from `env` files. --- CHANGES | 1 + test/bin/json_process.c | 5 +---- test/suites/encoding-flags/compact-array/env | 1 - test/suites/encoding-flags/compact-object/env | 1 - test/suites/encoding-flags/ensure-ascii/env | 1 - test/suites/encoding-flags/indent-array/env | 1 - test/suites/encoding-flags/indent-compact-array/env | 1 - test/suites/encoding-flags/indent-compact-object/env | 1 - test/suites/encoding-flags/indent-object/env | 1 - test/suites/encoding-flags/object/env | 1 - test/suites/encoding-flags/preserve-order/env | 1 - test/suites/encoding-flags/real-precision/env | 1 - test/suites/encoding-flags/sort-keys/env | 1 - test/suites/valid/run | 3 --- 14 files changed, 2 insertions(+), 18 deletions(-) diff --git a/CHANGES b/CHANGES index cf3e4ef5..1801428d 100644 --- a/CHANGES +++ b/CHANGES @@ -12,6 +12,7 @@ Work in progress * Build: - Make test output nicer in CMake based builds (#683) + - Simplify tests (#685) Version 2.14 ============ diff --git a/test/bin/json_process.c b/test/bin/json_process.c index 3fa926b9..965fa6b2 100644 --- a/test/bin/json_process.c +++ b/test/bin/json_process.c @@ -80,11 +80,10 @@ static char *loadfile(FILE *file) { static void read_conf(FILE *conffile) { char *buffer, *line, *val; + conf.have_hashseed = 0; buffer = loadfile(conffile); for (line = strtok(buffer, "\r\n"); line; line = strtok(NULL, "\r\n")) { - if (!strncmp(line, "export ", 7)) - continue; val = strchr(line, '='); if (!val) { printf("invalid configuration line\n"); @@ -109,8 +108,6 @@ static void read_conf(FILE *conffile) { if (!strcmp(line, "HASHSEED")) { conf.have_hashseed = 1; conf.hashseed = atoi(val); - } else { - conf.have_hashseed = 0; } } diff --git a/test/suites/encoding-flags/compact-array/env b/test/suites/encoding-flags/compact-array/env index 4474aaf1..beddaa89 100644 --- a/test/suites/encoding-flags/compact-array/env +++ b/test/suites/encoding-flags/compact-array/env @@ -1,2 +1 @@ JSON_COMPACT=1 -export JSON_COMPACT diff --git a/test/suites/encoding-flags/compact-object/env b/test/suites/encoding-flags/compact-object/env index 93cb33dd..57cf7b4c 100644 --- a/test/suites/encoding-flags/compact-object/env +++ b/test/suites/encoding-flags/compact-object/env @@ -1,3 +1,2 @@ JSON_COMPACT=1 HASHSEED=1 -export JSON_COMPACT HASHSEED diff --git a/test/suites/encoding-flags/ensure-ascii/env b/test/suites/encoding-flags/ensure-ascii/env index 1b7b3e3f..7867c323 100644 --- a/test/suites/encoding-flags/ensure-ascii/env +++ b/test/suites/encoding-flags/ensure-ascii/env @@ -1,2 +1 @@ JSON_ENSURE_ASCII=1 -export JSON_ENSURE_ASCII diff --git a/test/suites/encoding-flags/indent-array/env b/test/suites/encoding-flags/indent-array/env index d220f837..11f6684e 100644 --- a/test/suites/encoding-flags/indent-array/env +++ b/test/suites/encoding-flags/indent-array/env @@ -1,2 +1 @@ JSON_INDENT=4 -export JSON_INDENT diff --git a/test/suites/encoding-flags/indent-compact-array/env b/test/suites/encoding-flags/indent-compact-array/env index 78fbfcc2..f6a3b3ea 100644 --- a/test/suites/encoding-flags/indent-compact-array/env +++ b/test/suites/encoding-flags/indent-compact-array/env @@ -1,3 +1,2 @@ JSON_INDENT=4 JSON_COMPACT=1 -export JSON_INDENT JSON_COMPACT diff --git a/test/suites/encoding-flags/indent-compact-object/env b/test/suites/encoding-flags/indent-compact-object/env index c73acc17..d3a706ee 100644 --- a/test/suites/encoding-flags/indent-compact-object/env +++ b/test/suites/encoding-flags/indent-compact-object/env @@ -1,4 +1,3 @@ JSON_INDENT=4 JSON_COMPACT=1 HASHSEED=1 -export JSON_INDENT JSON_COMPACT HASHSEED diff --git a/test/suites/encoding-flags/indent-object/env b/test/suites/encoding-flags/indent-object/env index 961558ca..f08e8475 100644 --- a/test/suites/encoding-flags/indent-object/env +++ b/test/suites/encoding-flags/indent-object/env @@ -1,3 +1,2 @@ JSON_INDENT=4 HASHSEED=1 -export JSON_INDENT HASHSEED diff --git a/test/suites/encoding-flags/object/env b/test/suites/encoding-flags/object/env index 9120b035..9e1ca2a8 100644 --- a/test/suites/encoding-flags/object/env +++ b/test/suites/encoding-flags/object/env @@ -1,2 +1 @@ HASHSEED=1 -export HASHSEED diff --git a/test/suites/encoding-flags/preserve-order/env b/test/suites/encoding-flags/preserve-order/env index 4d9d2065..504bf510 100644 --- a/test/suites/encoding-flags/preserve-order/env +++ b/test/suites/encoding-flags/preserve-order/env @@ -1,2 +1 @@ JSON_PRESERVE_ORDER=1 -export JSON_PRESERVE_ORDER diff --git a/test/suites/encoding-flags/real-precision/env b/test/suites/encoding-flags/real-precision/env index 9c52cbcd..8ec3a7cd 100644 --- a/test/suites/encoding-flags/real-precision/env +++ b/test/suites/encoding-flags/real-precision/env @@ -1,2 +1 @@ JSON_REAL_PRECISION=4 -export JSON_REAL_PRECISION diff --git a/test/suites/encoding-flags/sort-keys/env b/test/suites/encoding-flags/sort-keys/env index 3ef24cb7..1e27ccf9 100644 --- a/test/suites/encoding-flags/sort-keys/env +++ b/test/suites/encoding-flags/sort-keys/env @@ -1,2 +1 @@ JSON_SORT_KEYS=1 -export JSON_SORT_KEYS diff --git a/test/suites/valid/run b/test/suites/valid/run index afc488c9..665aad0a 100755 --- a/test/suites/valid/run +++ b/test/suites/valid/run @@ -5,9 +5,6 @@ # Jansson is free software; you can redistribute it and/or modify # it under the terms of the MIT license. See LICENSE for details. -JSON_SORT_KEYS=1 -export JSON_SORT_KEYS - is_test() { test -d $test_path }