diff options
| author | Paul Buetow <paul@buetow.org> | 2026-06-05 16:33:29 +0300 |
|---|---|---|
| committer | Paul Buetow <paul@buetow.org> | 2026-06-05 16:33:29 +0300 |
| commit | 46fe0523140b8da22d9992adfbda3ee8fb6fcfb8 (patch) | |
| tree | aa94d8eba97cba12a59a3c4500d1e2f2223cbf7e /tests | |
| parent | e73a4803a9261cb71985872cf66be4a8b9fdda53 (diff) | |
Slim template render context interface
Diffstat (limited to 'tests')
| -rwxr-xr-x | tests/cli.sh | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/tests/cli.sh b/tests/cli.sh index 8056da5..975b724 100755 --- a/tests/cli.sh +++ b/tests/cli.sh @@ -2483,6 +2483,45 @@ test_generate_templates_cannot_read_renderer_internals() { test::teardown } +test_generate_templates_cannot_read_serialized_context_hook() { + local config_file + local fake_bin + local output + local template_dir + + test::setup + fake_bin="$TEST_TMPDIR/bin" + config_file="$TEST_TMPDIR/photoalbum.conf" + template_dir="$TEST_TMPDIR/templates" + + test::install_fake_imagemagick "$fake_bin" + PATH="$fake_bin:$PATH" \ + test::generate_fixture_images "$TEST_TMPDIR/incoming" + cp -R "$TEST_REPO_ROOT/share/templates/default" "$template_dir" + # shellcheck disable=SC2016 + printf 'printf "bash env: %%s\\n" "${BASH_ENV}"\n' \ + > "$template_dir/preview.tmpl" + mkdir -p "$TEST_TMPDIR/dist" + printf 'old index\n' > "$TEST_TMPDIR/dist/index.html" + test::write_album_config \ + "$config_file" "$TEST_TMPDIR/incoming" "$TEST_TMPDIR/dist" \ + 'Renderer context album' 40 + printf 'TEMPLATE_DIR=%q\n' "$template_dir" >> "$config_file" + + output=$( + cd "$TEST_TMPDIR" + PATH="$fake_bin:$PATH" BASH_ENV=ambient \ + test::capture_failure_output "$TEST_PHOTOALBUM" --generate + ) + + test::assert_contains 'BASH_ENV: unbound variable' "$output" + test "$(<"$TEST_TMPDIR/dist/index.html")" = 'old index' + test::assert_path_absent "$TEST_TMPDIR/dist/photos/01-landscape.jpg" + test::assert_path_absent "$TEST_TMPDIR/dist/photoalbum.json" + test::assert_no_staging_dirs "$TEST_TMPDIR" + test::teardown +} + test_generate_swap_failure_restores_dist() { local config_file local fake_bin @@ -3048,6 +3087,9 @@ main() { '--generate templates cannot read renderer internals' \ test_generate_templates_cannot_read_renderer_internals test::run_case \ + '--generate templates cannot read serialized context hook' \ + test_generate_templates_cannot_read_serialized_context_hook + test::run_case \ '--generate swap failure restores final dist' \ test_generate_swap_failure_restores_dist test::run_case \ |
