Skip to content

Comments

Cleanup tests#1277

Merged
johnbartholomew merged 4 commits intogoogle:masterfrom
johnbartholomew:cleanup-tests
Feb 9, 2026
Merged

Cleanup tests#1277
johnbartholomew merged 4 commits intogoogle:masterfrom
johnbartholomew:cleanup-tests

Conversation

@johnbartholomew
Copy link
Collaborator

Trying to clean up the test infrastructure in little steps.

  • Rename some things to prefer naming tests ending with _test (instead of having test somewhere in the middle)
  • Try to get all build systems to run all tests.
  • Make tests more self-isolated where possible, rather than relying on inputs from a test runner/test harness. For what was libjsonnet_test_snippet, it was quite strange since the code sets up the Jsonnet VM with three extra native functions but then... doesn't actually exercise that code-path at all unless you give it a snippet (as a command line argument) that uses them, which the test harness shell script doesn't because it just runs a trivial std.assertEquals expression). This is renamed and updated to explicitly test the native callback facility and not take any command line arguments.
  • Delete a shell script that I think is unused.

libjsonnet_test_snippet was strange, because it _defined_ three native
functions (that can be used with `std.native`), but it didn't actually
try using them, and it took an input snippet on the command line so
a critical part of the test came from the test harness (tests.sh).

The replacement is self-contained. It doesn't use GoogleTest because
it's written in plain C, not C++. Other than that, it works like any
other test executable, running a few separate tests and reporting
the results.

tests.sh is updated accordingly
The Makefile is updated also.
The CMakeLists.txt is updated to also run this test with CTest.
The core/BUILD file is updated to add this as a Bazel test.
Normalize test naming to end with _test instead of having it in the middle.
The tests that it runs are directly run by the root tests.sh anyway.
Normalize test naming to end with _test instead of having it in the middle.
@johnbartholomew johnbartholomew merged commit 9201aeb into google:master Feb 9, 2026
12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant