diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 9300095..d4258cb 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -81,6 +81,19 @@ jobs: run: ./ci/install-rust.sh "${{ matrix.rust-version }}" --profile minimal - run: ./ci/build-and-test.sh + external-tests: + runs-on: ubuntu-24.04 + strategy: + matrix: + include: + - rust-version: msrv + - rust-version: stable + steps: + - uses: actions/checkout@v4 + - name: Install Rust + run: ./ci/install-rust.sh "${{ matrix.rust-version }}" --profile minimal + - run: ./ci/external-tests.sh + package-crates: runs-on: ubuntu-24.04 steps: diff --git a/README.md b/README.md index a9fd301..d356ad0 100644 --- a/README.md +++ b/README.md @@ -72,7 +72,3 @@ Licensed under either of ) at your option. - -Part of the test suite ([ui-tests/jsonnet-0.20.0](ui-tests/jsonnet-0.20.0)) is -taken from the [C++ implementation](https://github.com/google/jsonnet), which -is licensed under Apache 2.0. diff --git a/ci/external-tests.sh b/ci/external-tests.sh new file mode 100755 index 0000000..b283c13 --- /dev/null +++ b/ci/external-tests.sh @@ -0,0 +1,105 @@ +#!/usr/bin/env bash +set -euo pipefail + +. ci/utils.sh + +begin_group "Fetch dependencies" +cargo fetch --locked +end_group + +begin_group "Build" +cargo build -p rsjsonnet --frozen +end_group + +ext_jsonnet_ver="0.20.0" +begin_group "Download jsonnet $ext_jsonnet_ver" +curl -fL "https://github.com/google/jsonnet/archive/refs/tags/v${ext_jsonnet_ver}.tar.gz" | tar -xz +end_group + +begin_group "Test" + +ext_src_dir="$(readlink -f -- "jsonnet-$ext_jsonnet_ver")" +test_bin="$(readlink -f -- "target/debug/rsjsonnet")" + +failures=0 + +cd "$ext_src_dir/test_suite" +for test in *.jsonnet; do + # Skip error tests + #if [[ "$test" == error.* ]]; then + # continue + #fi + + extra_args=() + + if [[ "$test" =~ ^tla[.] ]]; then + extra_args+=("--tla-str" "var1=test" "--tla-code" "var2={x:1,y:2}") + else + extra_args+=("--ext-str" "var1=test" "--ext-code" "var2={x:1,y:2}") + fi + + echo -n "test $test ..." + set +e + ( + NO_COLOR=1 "$test_bin" "${extra_args[@]}" "$test" > test_result.stdout 2> test_result.stderr + exit_code=$? + + if [[ "$test" = error.* ]] || [ "$test" = "invariant_manifest.jsonnet" ]; then + if [[ $exit_code -ne 1 ]]; then + echo "Finished with exit code $exit_code" + exit 1 + fi + else + if [[ $exit_code -ne 0 ]]; then + echo "Finished with exit code $exit_code" + echo "stderr:" + cat test_result.stderr + exit 1 + fi + + if [ "$test" = "trace.jsonnet" ]; then + # Skip checking output for trace test + exit 0 + fi + + if [ -s test_result.stderr ]; then + echo "stderr is not empty:" + cat test_result.stderr + exit 1 + fi + + if [ "$test" = "unparse.jsonnet" ]; then + # Skip checking stdout for unparse.jsonnet due to rounding differences + exit 0 + fi + + if [ ! -e "$test.golden" ]; then + echo "true" > "$test.golden" + fi + + diff "$test.golden" test_result.stdout > stdout.diff + if [ -s stdout.diff ]; then + echo "unexpected stdout" + cat stdout.diff + exit 1 + fi + fi + ) > test_report.txt 2>&1 + exit_code=$? + set -e + + if [[ $exit_code -ne 0 ]]; then + echo " fail" + failures=$((failures + 1)) + cat test_report.txt + else + echo " ok" + fi +done + +end_group + +if [[ $failures -ne 0 ]]; then + echo "Failed $failures test(s)" + exit 1 +fi diff --git a/ui-tests/README.txt b/ui-tests/README.txt deleted file mode 100644 index 82fece9..0000000 --- a/ui-tests/README.txt +++ /dev/null @@ -1 +0,0 @@ -Tests in jsonnet-0.20.0 are from C++ jsonnet 0.20.0 test suite. diff --git a/ui-tests/jsonnet-0.20.0/arith_bool.jsonnet b/ui-tests/jsonnet-0.20.0/arith_bool.jsonnet deleted file mode 100644 index 834bb14..0000000 --- a/ui-tests/jsonnet-0.20.0/arith_bool.jsonnet +++ /dev/null @@ -1,52 +0,0 @@ -/* -Copyright 2015 Google Inc. All rights reserved. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -std.assertEqual(!false, true) && -std.assertEqual(!true, false) && -std.assertEqual(!!true, true) && -std.assertEqual(!!false, false) && - -std.assertEqual(false && false, false) && -std.assertEqual(false && true, false) && -std.assertEqual(true && false, false) && -std.assertEqual(true && true, true) && - -std.assertEqual(false || false, false) && -std.assertEqual(false || true, true) && -std.assertEqual(true || false, true) && -std.assertEqual(true || true, true) && - -// Shortcut semantics -std.assertEqual(false && error 'foo', false) && -std.assertEqual(true || error 'foo', true) && - -std.assertEqual(false == false, true) && -std.assertEqual(false == true, false) && -std.assertEqual(true == false, false) && -std.assertEqual(true == true, true) && - -std.assertEqual(false != false, false) && -std.assertEqual(false != true, true) && -std.assertEqual(true != false, true) && -std.assertEqual(true != true, false) && - -std.assertEqual('1' == 1, false) && -std.assertEqual('true' == true, false) && - -std.assertEqual(if true then 3 else 5, 3) && -std.assertEqual(if false then 3 else 5, 5) && - -true diff --git a/ui-tests/jsonnet-0.20.0/arith_float.jsonnet b/ui-tests/jsonnet-0.20.0/arith_float.jsonnet deleted file mode 100644 index 9d9b688..0000000 --- a/ui-tests/jsonnet-0.20.0/arith_float.jsonnet +++ /dev/null @@ -1,139 +0,0 @@ -/* -Copyright 2015 Google Inc. All rights reserved. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -//Test lexing: -std.assertEqual(0, 0.0) && -std.assertEqual(0e0, 0.0) && -std.assertEqual(0e+0, 0.0) && -std.assertEqual(0e-0, 0.0) && -std.assertEqual(0e00, 0.0) && -std.assertEqual(0E0, 0.0) && -std.assertEqual(0E+0, 0.0) && -std.assertEqual(0E-0, 0.0) && -std.assertEqual(0E00, 0.0) && -std.assertEqual(0.0e0, 0.0) && -std.assertEqual(0.0e+0, 0.0) && -std.assertEqual(0.0e-0, 0.0) && -std.assertEqual(0.0e00, 0.0) && -std.assertEqual(0.0E0, 0.0) && -std.assertEqual(0.0E+0, 0.0) && -std.assertEqual(0.0E-0, 0.0) && -std.assertEqual(0.0E00, 0.0) && -std.assertEqual(0.00e0, 0.0) && -std.assertEqual(0.00e+0, 0.0) && -std.assertEqual(0.00e-0, 0.0) && -std.assertEqual(0.00e00, 0.0) && -std.assertEqual(0.00E0, 0.0) && -std.assertEqual(0.00E+0, 0.0) && -std.assertEqual(0.00E-0, 0.0) && -std.assertEqual(0.00E00, 0.0) && - -std.assertEqual(1, 1.0) && -std.assertEqual(1e0, 1.0) && -std.assertEqual(1e+0, 1.0) && -std.assertEqual(1e-0, 1.0) && -std.assertEqual(1e00, 1.0) && -std.assertEqual(1E0, 1.0) && -std.assertEqual(1E+0, 1.0) && -std.assertEqual(1E-0, 1.0) && -std.assertEqual(1E00, 1.0) && -std.assertEqual(1.0e0, 1.0) && -std.assertEqual(1.0e+0, 1.0) && -std.assertEqual(1.0e-0, 1.0) && -std.assertEqual(1.0e00, 1.0) && -std.assertEqual(1.0E0, 1.0) && -std.assertEqual(1.0E+0, 1.0) && -std.assertEqual(1.0E-0, 1.0) && -std.assertEqual(1.0E00, 1.0) && -std.assertEqual(1.00e0, 1.0) && -std.assertEqual(1.00e+0, 1.0) && -std.assertEqual(1.00e-0, 1.0) && -std.assertEqual(1.00e00, 1.0) && -std.assertEqual(1.00E0, 1.0) && -std.assertEqual(1.00E+0, 1.0) && -std.assertEqual(1.00E-0, 1.0) && -std.assertEqual(1.00E00, 1.0) && - -std.assertEqual(11, 11.0) && -std.assertEqual(11e0, 11.0) && -std.assertEqual(11e+0, 11.0) && -std.assertEqual(11e-0, 11.0) && -std.assertEqual(11e00, 11.0) && -std.assertEqual(11E0, 11.0) && -std.assertEqual(11E+0, 11.0) && -std.assertEqual(11E-0, 11.0) && -std.assertEqual(11E00, 11.0) && -std.assertEqual(11.0e0, 11.0) && -std.assertEqual(11.0e+0, 11.0) && -std.assertEqual(11.0e-0, 11.0) && -std.assertEqual(11.0e00, 11.0) && -std.assertEqual(11.0E0, 11.0) && -std.assertEqual(11.0E+0, 11.0) && -std.assertEqual(11.0E-0, 11.0) && -std.assertEqual(11.0E00, 11.0) && -std.assertEqual(11.00e0, 11.0) && -std.assertEqual(11.00e+0, 11.0) && -std.assertEqual(11.00e-0, 11.0) && -std.assertEqual(11.00e00, 11.0) && -std.assertEqual(11.00E0, 11.0) && -std.assertEqual(11.00E+0, 11.0) && -std.assertEqual(11.00E-0, 11.0) && -std.assertEqual(11.00E00, 11.0) && - -// Test arithmetic -std.assertEqual(4.5 + 3, 7.5) && -std.assertEqual(4.5 - 2, 2.5) && -std.assertEqual(4.5 * 3, 13.5) && -std.assertEqual(4.5 / 3, 1.5) && -std.assertEqual(4.5 % 2, 0.5) && - -std.assertEqual(4.5 << 2, 16) && -std.assertEqual(4.5 << 66, 16) && -std.assertEqual(4.5 >> 2, 1) && -std.assertEqual(4.5 >> 66, 1) && -std.assertEqual(4.5 ^ 3.6, 7) && -std.assertEqual(5.5 & 3.3, 1) && -std.assertEqual(4.5 | 1.9, 5) && - -std.assertEqual(~4.5, -# -5) && - -std.assertEqual(~4.5, -5) && -std.assertEqual(-4.5, 0-4.5) && - -std.assertEqual(4.5 >= 4.5, true) && -std.assertEqual(4.5 > 1, true) && -std.assertEqual(4.5 <= 4.5, true) && -std.assertEqual(4.5 < 5, true) && -std.assertEqual(4.5 > 4.5, false) && -std.assertEqual(4.5 <= 1, false) && -std.assertEqual(4.5 < 4.5, false) && -std.assertEqual(4.5 >= 5, false) && - -std.assertEqual(4.5 == 4.5, true) && -std.assertEqual(4.5 != 3.5, true) && - -std.assertEqual(std.toString(1e20), "100000000000000000000") && - -// Check formatter handles - $ correctly. -local obj = { - f: { f: { f: 1 } }, - g: - $.f.f.f, -}; - -std.assertEqual(obj.g, -1) && - -true diff --git a/ui-tests/jsonnet-0.20.0/arith_string.jsonnet b/ui-tests/jsonnet-0.20.0/arith_string.jsonnet deleted file mode 100644 index 55a23f8..0000000 --- a/ui-tests/jsonnet-0.20.0/arith_string.jsonnet +++ /dev/null @@ -1,58 +0,0 @@ -/* -Copyright 2015 Google Inc. All rights reserved. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -std.assertEqual('foo', 'foo') && -std.assertEqual('foo' == 'foo', true) && -std.assertEqual('foo' != 'bar', true) && -std.assertEqual('foo' != 'foo', false) && -std.assertEqual('foo' == 'bar', false) && -std.assertEqual('foo' + 'bar', 'foobar') && - -std.assertEqual('foo' + true, 'footrue') && -std.assertEqual('foo' + false, 'foofalse') && -std.assertEqual('foo' + 0, 'foo0') && -std.assertEqual('foo' + null, 'foonull') && - -std.assertEqual(true + 'foo', 'truefoo') && -std.assertEqual(false + 'foo', 'falsefoo') && -std.assertEqual(0 + 'foo', '0foo') && -std.assertEqual(null + 'foo', 'nullfoo') && - -std.assertEqual('foo' < 'bar', false) && -std.assertEqual('foo' <= 'bar', false) && -std.assertEqual('bar' < 'foo', true) && -std.assertEqual('bar' <= 'foo', true) && -std.assertEqual('foo' > 'bar', true) && -std.assertEqual('foo' >= 'bar', true) && -std.assertEqual('bar' > 'foo', false) && -std.assertEqual('bar' >= 'foo', false) && -std.assertEqual('afoo' < 'abar', false) && -std.assertEqual('afoo' <= 'abar', false) && -std.assertEqual('abar' < 'afoo', true) && -std.assertEqual('abar' <= 'afoo', true) && -std.assertEqual('afoo' > 'abar', true) && -std.assertEqual('afoo' >= 'abar', true) && -std.assertEqual('abar' > 'afoo', false) && -std.assertEqual('abar' >= 'afoo', false) && -std.assertEqual('a' >= 'a', true) && -std.assertEqual('a' <= 'a', true) && -std.assertEqual('a' > 'a', false) && -std.assertEqual('a' < 'a', false) && - -std.assertEqual('alphabet'[7], 't') && -std.assertEqual('alphabet'[0], 'a') && - -true diff --git a/ui-tests/jsonnet-0.20.0/array.jsonnet b/ui-tests/jsonnet-0.20.0/array.jsonnet deleted file mode 100644 index 2875cc2..0000000 --- a/ui-tests/jsonnet-0.20.0/array.jsonnet +++ /dev/null @@ -1,57 +0,0 @@ -/* -Copyright 2015 Google Inc. All rights reserved. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -std.assertEqual([], []) && -std.assertEqual([1], [1]) && -std.assertEqual([1,], [1]) && -std.assertEqual([1, 4, 9, 16][2], 9) && -std.assertEqual([1, 4, 9, 16] == [1, 4, 9, 16], true) && -std.assertEqual([1, 4, 9, 16] != [1, 4, 9, 15], true) && -std.assertEqual([1, 4, 9, 16] == [1, 4, 9, 15], false) && -std.assertEqual([1, 4, 9, 16] != [1, 4, 9, 16], false) && - -std.assertEqual([1, 4, 9, 16] == [1, 4, 9, 16, 17], false) && -std.assertEqual([1, 4, 9, 16] != [1, 4, 9, 16, 17], true) && -std.assertEqual([1, 4, 9, 16, 17] == [1, 4, 9, 16], false) && -std.assertEqual([1, 4, 9, 16, 17] != [1, 4, 9, 16], true) && - -std.assertEqual([1, 4, 9, error 'foo'][2], 9) && -std.assertEqual([] + [1, 2, 3] + [4, 5, 6] + [], [1, 2, 3, 4, 5, 6]) && -std.assertEqual([] + [], []) && - -std.assertEqual([x * x for x in [1, 2, 3, 4]], [1, 4, 9, 16]) && -std.assertEqual([x * x for x in [-3, -2, -1, 0, 1, 2, 3] if x >= 0], [0, 1, 4, 9]) && - -std.assertEqual([x * x for x in [-3, -2, -1, 0, 1, 2, 3] if x >= 0], [0, 1, 4, 9]) && -std.assertEqual([x * x for x in []], []) && - -std.assertEqual(local x = 10; [x for x in [x, x, x]], [10, 10, 10]) && - -local arr = [ - { x: 1, y: 4, z: true }, - { x: 1, y: 4, z: false }, - { x: 1, y: 6, z: true }, - { x: 1, y: 6, z: false }, - { x: 2, y: 6, z: true }, - { x: 2, y: 6, z: false }, - { x: 3, y: 6, z: true }, - { x: 3, y: 6, z: false }, -]; - -std.assertEqual(arr, [{ x: x, y: y, z: z } for x in [1, 2, 3] for y in [1, 4, 6] if x + 2 < y for z in [true, false]]) && - - -true diff --git a/ui-tests/jsonnet-0.20.0/array_comparison.jsonnet b/ui-tests/jsonnet-0.20.0/array_comparison.jsonnet deleted file mode 100644 index bec396c..0000000 --- a/ui-tests/jsonnet-0.20.0/array_comparison.jsonnet +++ /dev/null @@ -1,16 +0,0 @@ -local arrs = [ - [], - [1, 2], - [1, 2, 3], - [2, 3], -]; -[ - { - ['%s < %s' % [x, y]]: x < y, - ['%s > %s' % [x, y]]: x > y, - ['%s <= %s' % [x, y]]: x <= y, - ['%s >= %s' % [x, y]]: x >= y, - } - for x in arrs - for y in arrs -] diff --git a/ui-tests/jsonnet-0.20.0/array_comparison.stdout b/ui-tests/jsonnet-0.20.0/array_comparison.stdout deleted file mode 100644 index 5a6f35f..0000000 --- a/ui-tests/jsonnet-0.20.0/array_comparison.stdout +++ /dev/null @@ -1,98 +0,0 @@ -[ - { - "[ ] < [ ]": false, - "[ ] <= [ ]": true, - "[ ] > [ ]": false, - "[ ] >= [ ]": true - }, - { - "[ ] < [1, 2]": true, - "[ ] <= [1, 2]": true, - "[ ] > [1, 2]": false, - "[ ] >= [1, 2]": false - }, - { - "[ ] < [1, 2, 3]": true, - "[ ] <= [1, 2, 3]": true, - "[ ] > [1, 2, 3]": false, - "[ ] >= [1, 2, 3]": false - }, - { - "[ ] < [2, 3]": true, - "[ ] <= [2, 3]": true, - "[ ] > [2, 3]": false, - "[ ] >= [2, 3]": false - }, - { - "[1, 2] < [ ]": false, - "[1, 2] <= [ ]": false, - "[1, 2] > [ ]": true, - "[1, 2] >= [ ]": true - }, - { - "[1, 2] < [1, 2]": false, - "[1, 2] <= [1, 2]": true, - "[1, 2] > [1, 2]": false, - "[1, 2] >= [1, 2]": true - }, - { - "[1, 2] < [1, 2, 3]": true, - "[1, 2] <= [1, 2, 3]": true, - "[1, 2] > [1, 2, 3]": false, - "[1, 2] >= [1, 2, 3]": false - }, - { - "[1, 2] < [2, 3]": true, - "[1, 2] <= [2, 3]": true, - "[1, 2] > [2, 3]": false, - "[1, 2] >= [2, 3]": false - }, - { - "[1, 2, 3] < [ ]": false, - "[1, 2, 3] <= [ ]": false, - "[1, 2, 3] > [ ]": true, - "[1, 2, 3] >= [ ]": true - }, - { - "[1, 2, 3] < [1, 2]": false, - "[1, 2, 3] <= [1, 2]": false, - "[1, 2, 3] > [1, 2]": true, - "[1, 2, 3] >= [1, 2]": true - }, - { - "[1, 2, 3] < [1, 2, 3]": false, - "[1, 2, 3] <= [1, 2, 3]": true, - "[1, 2, 3] > [1, 2, 3]": false, - "[1, 2, 3] >= [1, 2, 3]": true - }, - { - "[1, 2, 3] < [2, 3]": true, - "[1, 2, 3] <= [2, 3]": true, - "[1, 2, 3] > [2, 3]": false, - "[1, 2, 3] >= [2, 3]": false - }, - { - "[2, 3] < [ ]": false, - "[2, 3] <= [ ]": false, - "[2, 3] > [ ]": true, - "[2, 3] >= [ ]": true - }, - { - "[2, 3] < [1, 2]": false, - "[2, 3] <= [1, 2]": false, - "[2, 3] > [1, 2]": true, - "[2, 3] >= [1, 2]": true - }, - { - "[2, 3] < [1, 2, 3]": false, - "[2, 3] <= [1, 2, 3]": false, - "[2, 3] > [1, 2, 3]": true, - "[2, 3] >= [1, 2, 3]": true - }, - { - "[2, 3] < [2, 3]": false, - "[2, 3] <= [2, 3]": true, - "[2, 3] > [2, 3]": false, - "[2, 3] >= [2, 3]": true - } -] diff --git a/ui-tests/jsonnet-0.20.0/array_comparison2.jsonnet b/ui-tests/jsonnet-0.20.0/array_comparison2.jsonnet deleted file mode 100644 index 62e72fb..0000000 --- a/ui-tests/jsonnet-0.20.0/array_comparison2.jsonnet +++ /dev/null @@ -1,16 +0,0 @@ -local arrs = [ - [[]], - [[1, 2]], - [[1], [2]], - [[1, 2], []], -]; -[ - { - ['%s < %s' % [x, y]]: x < y, - ['%s > %s' % [x, y]]: x > y, - ['%s <= %s' % [x, y]]: x <= y, - ['%s >= %s' % [x, y]]: x >= y, - } - for x in arrs - for y in arrs -] diff --git a/ui-tests/jsonnet-0.20.0/array_comparison2.stdout b/ui-tests/jsonnet-0.20.0/array_comparison2.stdout deleted file mode 100644 index 5583b4d..0000000 --- a/ui-tests/jsonnet-0.20.0/array_comparison2.stdout +++ /dev/null @@ -1,98 +0,0 @@ -[ - { - "[[ ]] < [[ ]]": false, - "[[ ]] <= [[ ]]": true, - "[[ ]] > [[ ]]": false, - "[[ ]] >= [[ ]]": true - }, - { - "[[ ]] < [[1, 2]]": true, - "[[ ]] <= [[1, 2]]": true, - "[[ ]] > [[1, 2]]": false, - "[[ ]] >= [[1, 2]]": false - }, - { - "[[ ]] < [[1], [2]]": true, - "[[ ]] <= [[1], [2]]": true, - "[[ ]] > [[1], [2]]": false, - "[[ ]] >= [[1], [2]]": false - }, - { - "[[ ]] < [[1, 2], [ ]]": true, - "[[ ]] <= [[1, 2], [ ]]": true, - "[[ ]] > [[1, 2], [ ]]": false, - "[[ ]] >= [[1, 2], [ ]]": false - }, - { - "[[1, 2]] < [[ ]]": false, - "[[1, 2]] <= [[ ]]": false, - "[[1, 2]] > [[ ]]": true, - "[[1, 2]] >= [[ ]]": true - }, - { - "[[1, 2]] < [[1, 2]]": false, - "[[1, 2]] <= [[1, 2]]": true, - "[[1, 2]] > [[1, 2]]": false, - "[[1, 2]] >= [[1, 2]]": true - }, - { - "[[1, 2]] < [[1], [2]]": false, - "[[1, 2]] <= [[1], [2]]": false, - "[[1, 2]] > [[1], [2]]": true, - "[[1, 2]] >= [[1], [2]]": true - }, - { - "[[1, 2]] < [[1, 2], [ ]]": true, - "[[1, 2]] <= [[1, 2], [ ]]": true, - "[[1, 2]] > [[1, 2], [ ]]": false, - "[[1, 2]] >= [[1, 2], [ ]]": false - }, - { - "[[1], [2]] < [[ ]]": false, - "[[1], [2]] <= [[ ]]": false, - "[[1], [2]] > [[ ]]": true, - "[[1], [2]] >= [[ ]]": true - }, - { - "[[1], [2]] < [[1, 2]]": true, - "[[1], [2]] <= [[1, 2]]": true, - "[[1], [2]] > [[1, 2]]": false, - "[[1], [2]] >= [[1, 2]]": false - }, - { - "[[1], [2]] < [[1], [2]]": false, - "[[1], [2]] <= [[1], [2]]": true, - "[[1], [2]] > [[1], [2]]": false, - "[[1], [2]] >= [[1], [2]]": true - }, - { - "[[1], [2]] < [[1, 2], [ ]]": true, - "[[1], [2]] <= [[1, 2], [ ]]": true, - "[[1], [2]] > [[1, 2], [ ]]": false, - "[[1], [2]] >= [[1, 2], [ ]]": false - }, - { - "[[1, 2], [ ]] < [[ ]]": false, - "[[1, 2], [ ]] <= [[ ]]": false, - "[[1, 2], [ ]] > [[ ]]": true, - "[[1, 2], [ ]] >= [[ ]]": true - }, - { - "[[1, 2], [ ]] < [[1, 2]]": false, - "[[1, 2], [ ]] <= [[1, 2]]": false, - "[[1, 2], [ ]] > [[1, 2]]": true, - "[[1, 2], [ ]] >= [[1, 2]]": true - }, - { - "[[1, 2], [ ]] < [[1], [2]]": false, - "[[1, 2], [ ]] <= [[1], [2]]": false, - "[[1, 2], [ ]] > [[1], [2]]": true, - "[[1, 2], [ ]] >= [[1], [2]]": true - }, - { - "[[1, 2], [ ]] < [[1, 2], [ ]]": false, - "[[1, 2], [ ]] <= [[1, 2], [ ]]": true, - "[[1, 2], [ ]] > [[1, 2], [ ]]": false, - "[[1, 2], [ ]] >= [[1, 2], [ ]]": true - } -] diff --git a/ui-tests/jsonnet-0.20.0/condition.jsonnet b/ui-tests/jsonnet-0.20.0/condition.jsonnet deleted file mode 100644 index 2336c71..0000000 --- a/ui-tests/jsonnet-0.20.0/condition.jsonnet +++ /dev/null @@ -1,44 +0,0 @@ -/* -Copyright 2015 Google Inc. All rights reserved. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -local f(x) = - if x < 0 then - 'negative' - else if x == 0 then - 'zero' - else if x <= 5 then - 'small' - else if x <= 10 then - 'large' - else - 'huge'; - -std.assertEqual(f(-10), 'negative') && -std.assertEqual(f(0), 'zero') && -std.assertEqual(f(3), 'small') && -std.assertEqual(f(8), 'large') && -std.assertEqual(f(100), 'huge') && -std.assertEqual(if 1 > 0 then 1, 1) && -std.assertEqual(if 1 > 2 then 1, null) && - -std.assertEqual(if true then if false then 'f' else 'y', 'y') && -std.assertEqual(if true then (if false then 'f') else 'y', null) && - -std.assertEqual(if true then if true then 'f' + 'y', 'fy') && -std.assertEqual(if false then (if true then 'f') + 'y', null) && -std.assertEqual((if false then (if true then 'f')) + 'y', 'nully') && - -true diff --git a/ui-tests/jsonnet-0.20.0/format.jsonnet b/ui-tests/jsonnet-0.20.0/format.jsonnet deleted file mode 100644 index eb04c86..0000000 --- a/ui-tests/jsonnet-0.20.0/format.jsonnet +++ /dev/null @@ -1,313 +0,0 @@ -/* -Copyright 2015 Google Inc. All rights reserved. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -// # -std.assertEqual(std.format('No format chars\n', []), 'No format chars\n') && -std.assertEqual(std.format('', []), '') && -std.assertEqual(std.format('%#%', []), '%') && -std.assertEqual(std.format('%# +05.3%', []), ' %') && -std.assertEqual(std.format('%# -+05.3%', []), '% ') && - -// % -std.assertEqual(std.format('%%', []), '%') && -std.assertEqual(std.format('%%%%', []), '%%') && -std.assertEqual(std.format('%s%%', ['foo']), 'foo%') && -std.assertEqual(std.format('%%%s', ['foo']), '%foo') && - -// s -std.assertEqual(std.format('%s', ['test']), 'test') && -std.assertEqual(std.format('%s', [true]), 'true') && -std.assertEqual(std.format('%5s', ['test']), ' test') && - -// c -std.assertEqual(std.format('%c', ['a']), 'a') && -std.assertEqual(std.format('%# +05.3c', ['a']), ' a') && -std.assertEqual(std.format('%c', [std.codepoint('a')]), 'a') && - -// d (also a quick test of i and u) -std.assertEqual(std.format('thing-%d', [10]), 'thing-10') && -std.assertEqual(std.format('thing-%#ld', [10]), 'thing-10') && -std.assertEqual(std.format('thing-%d', [-10]), 'thing--10') && -std.assertEqual(std.format('thing-%4d', [10]), 'thing- 10') && -std.assertEqual(std.format('thing-%04d', [10]), 'thing-0010') && -std.assertEqual(std.format('thing-% d', [10]), 'thing- 10') && -std.assertEqual(std.format('thing-%- 4d', [10]), 'thing- 10 ') && -std.assertEqual(std.format('thing-% d', [-10]), 'thing--10') && -std.assertEqual(std.format('thing-%5.3d', [10.3]), 'thing- 010') && -std.assertEqual(std.format('thing-%+5.3d', [10.3]), 'thing- +010') && -std.assertEqual(std.format('thing-%+-5.3d', [10.3]), 'thing-+010 ') && -std.assertEqual(std.format('thing-%-5.3d', [10.3]), 'thing-010 ') && -std.assertEqual(std.format('thing-%#-5.3d', [10.3]), 'thing-010 ') && -std.assertEqual(std.format('thing-%#-5.3i', [10.3]), 'thing-010 ') && -std.assertEqual(std.format('thing-%#-5.3u', [10.3]), 'thing-010 ') && -std.assertEqual(std.format('thing-%5.3d', [-10.3]), 'thing- -010') && -std.assertEqual(std.format('thing-%+5.3d', [-10.3]), 'thing- -010') && -std.assertEqual(std.format('thing-%+-5.3d', [-10.3]), 'thing--010 ') && -std.assertEqual(std.format('thing-%-5.3d', [-10.3]), 'thing--010 ') && -std.assertEqual(std.format('thing-%#-5.3d', [-10.3]), 'thing--010 ') && -std.assertEqual(std.format('thing-%#-5.3i', [-10.3]), 'thing--010 ') && -std.assertEqual(std.format('thing-%#-5.3u', [-10.3]), 'thing--010 ') && -std.assertEqual(std.format('thing-%5.3d', [0.3]), 'thing- 000') && -std.assertEqual(std.format('thing-%+5.3d', [0.3]), 'thing- +000') && -std.assertEqual(std.format('thing-%+-5.3d', [0.3]), 'thing-+000 ') && -std.assertEqual(std.format('thing-%-5.3d', [0.3]), 'thing-000 ') && -std.assertEqual(std.format('thing-%#-5.3d', [0.3]), 'thing-000 ') && -std.assertEqual(std.format('thing-%#-5.3i', [0.3]), 'thing-000 ') && -std.assertEqual(std.format('thing-%#-5.3u', [0.3]), 'thing-000 ') && -std.assertEqual(std.format('thing-%5.3d', [-0.3]), 'thing- 000') && -std.assertEqual(std.format('thing-%+5.3d', [-0.3]), 'thing- +000') && -std.assertEqual(std.format('thing-%+-5.3d', [-0.3]), 'thing-+000 ') && -std.assertEqual(std.format('thing-%-5.3d', [-0.3]), 'thing-000 ') && -std.assertEqual(std.format('thing-%#-5.3d', [-0.3]), 'thing-000 ') && -std.assertEqual(std.format('thing-%#-5.3i', [-0.3]), 'thing-000 ') && -std.assertEqual(std.format('thing-%#-5.3u', [-0.3]), 'thing-000 ') && - -// o -std.assertEqual(std.format('thing-%o', [10]), 'thing-12') && -std.assertEqual(std.format('thing-%lo', [10]), 'thing-12') && -std.assertEqual(std.format('thing-%o', [-10]), 'thing--12') && -std.assertEqual(std.format('thing-%4o', [10]), 'thing- 12') && -std.assertEqual(std.format('thing-%04o', [10]), 'thing-0012') && -std.assertEqual(std.format('thing-% o', [10]), 'thing- 12') && -std.assertEqual(std.format('thing-%- 4o', [10]), 'thing- 12 ') && -std.assertEqual(std.format('thing-% o', [-10]), 'thing--12') && -std.assertEqual(std.format('thing-%5.3o', [10.3]), 'thing- 012') && -std.assertEqual(std.format('thing-%+5.3o', [10.3]), 'thing- +012') && -std.assertEqual(std.format('thing-%+-5.3o', [10.3]), 'thing-+012 ') && -std.assertEqual(std.format('thing-%-5.3o', [10.3]), 'thing-012 ') && -std.assertEqual(std.format('thing-%#o', [10]), 'thing-012') && -std.assertEqual(std.format('thing-%#lo', [10]), 'thing-012') && -std.assertEqual(std.format('thing-%#o', [-10]), 'thing--012') && -std.assertEqual(std.format('thing-%#4o', [10]), 'thing- 012') && -std.assertEqual(std.format('thing-%#04o', [10]), 'thing-0012') && -std.assertEqual(std.format('thing-%# o', [10]), 'thing- 012') && -std.assertEqual(std.format('thing-%#- 4o', [10]), 'thing- 012') && -std.assertEqual(std.format('thing-%# o', [-10]), 'thing--012') && -std.assertEqual(std.format('thing-%#5.3o', [10.3]), 'thing- 012') && -std.assertEqual(std.format('thing-%#+5.3o', [10.3]), 'thing- +012') && -std.assertEqual(std.format('thing-%#+-5.3o', [10.3]), 'thing-+012 ') && -std.assertEqual(std.format('thing-%#-5.3o', [10.3]), 'thing-012 ') && - -// x -std.assertEqual(std.format('thing-%x', [910]), 'thing-38e') && -std.assertEqual(std.format('thing-%lx', [910]), 'thing-38e') && -std.assertEqual(std.format('thing-%x', [-910]), 'thing--38e') && -std.assertEqual(std.format('thing-%5x', [910]), 'thing- 38e') && -std.assertEqual(std.format('thing-%05x', [910]), 'thing-0038e') && -std.assertEqual(std.format('thing-% x', [910]), 'thing- 38e') && -std.assertEqual(std.format('thing-%- 5x', [910]), 'thing- 38e ') && -std.assertEqual(std.format('thing-% x', [-910]), 'thing--38e') && -std.assertEqual(std.format('thing-%6.4x', [910.3]), 'thing- 038e') && -std.assertEqual(std.format('thing-%+6.4x', [910.3]), 'thing- +038e') && -std.assertEqual(std.format('thing-%+-6.4x', [910.3]), 'thing-+038e ') && -std.assertEqual(std.format('thing-%-6.4x', [910.3]), 'thing-038e ') && -std.assertEqual(std.format('thing-%#x', [910]), 'thing-0x38e') && -std.assertEqual(std.format('thing-%#lx', [910]), 'thing-0x38e') && -std.assertEqual(std.format('thing-%#x', [-910]), 'thing--0x38e') && -std.assertEqual(std.format('thing-%#7x', [910]), 'thing- 0x38e') && -std.assertEqual(std.format('thing-%#07x', [910]), 'thing-0x0038e') && -std.assertEqual(std.format('thing-%# x', [910]), 'thing- 0x38e') && -std.assertEqual(std.format('thing-%#- 7x', [910]), 'thing- 0x38e ') && -std.assertEqual(std.format('thing-%# x', [-910]), 'thing--0x38e') && -std.assertEqual(std.format('thing-%#8.4x', [910.3]), 'thing- 0x038e') && -std.assertEqual(std.format('thing-%#+8.4x', [910.3]), 'thing- +0x038e') && -std.assertEqual(std.format('thing-%#+-8.4x', [910.3]), 'thing-+0x038e ') && -std.assertEqual(std.format('thing-%#-8.4x', [910.3]), 'thing-0x038e ') && - -// X -std.assertEqual(std.format('thing-%X', [910]), 'thing-38E') && -std.assertEqual(std.format('thing-%lX', [910]), 'thing-38E') && -std.assertEqual(std.format('thing-%X', [-910]), 'thing--38E') && -std.assertEqual(std.format('thing-%5X', [910]), 'thing- 38E') && -std.assertEqual(std.format('thing-%05X', [910]), 'thing-0038E') && -std.assertEqual(std.format('thing-% X', [910]), 'thing- 38E') && -std.assertEqual(std.format('thing-%- 5X', [910]), 'thing- 38E ') && -std.assertEqual(std.format('thing-% X', [-910]), 'thing--38E') && -std.assertEqual(std.format('thing-%6.4X', [910.3]), 'thing- 038E') && -std.assertEqual(std.format('thing-%+6.4X', [910.3]), 'thing- +038E') && -std.assertEqual(std.format('thing-%+-6.4X', [910.3]), 'thing-+038E ') && -std.assertEqual(std.format('thing-%-6.4X', [910.3]), 'thing-038E ') && -std.assertEqual(std.format('thing-%#X', [910]), 'thing-0X38E') && -std.assertEqual(std.format('thing-%#lX', [910]), 'thing-0X38E') && -std.assertEqual(std.format('thing-%#X', [-910]), 'thing--0X38E') && -std.assertEqual(std.format('thing-%#7X', [910]), 'thing- 0X38E') && -std.assertEqual(std.format('thing-%#07X', [910]), 'thing-0X0038E') && -std.assertEqual(std.format('thing-%# X', [910]), 'thing- 0X38E') && -std.assertEqual(std.format('thing-%#- 7X', [910]), 'thing- 0X38E ') && -std.assertEqual(std.format('thing-%# X', [-910]), 'thing--0X38E') && -std.assertEqual(std.format('thing-%#8.4X', [910.3]), 'thing- 0X038E') && -std.assertEqual(std.format('thing-%#+8.4X', [910.3]), 'thing- +0X038E') && -std.assertEqual(std.format('thing-%#+-8.4X', [910.3]), 'thing-+0X038E ') && -std.assertEqual(std.format('thing-%#-8.4X', [910.3]), 'thing-0X038E ') && - -// e -std.assertEqual(std.format('%e', [910]), '9.100000e+02') && -std.assertEqual(std.format('%e', [0]), '0.000000e+00') && -std.assertEqual(std.format('%.0le', [910]), '9e+02') && -std.assertEqual(std.format('%.0le', [0]), '0e+00') && -std.assertEqual(std.format('%#e', [-910]), '-9.100000e+02') && -std.assertEqual(std.format('%16e', [910]), ' 9.100000e+02') && -std.assertEqual(std.format('%016e', [910]), '00009.100000e+02') && -std.assertEqual(std.format('% e', [910]), ' 9.100000e+02') && -std.assertEqual(std.format('%- 16e', [910]), ' 9.100000e+02 ') && -std.assertEqual(std.format('% e', [-910]), '-9.100000e+02') && -std.assertEqual(std.format('%16.4e', [910.3]), ' 9.1030e+02') && -std.assertEqual(std.format('%+16.4e', [910.3]), ' +9.1030e+02') && -std.assertEqual(std.format('%+-16.4e', [910.3]), '+9.1030e+02 ') && -std.assertEqual(std.format('%-16.4e', [910.3]), '9.1030e+02 ') && -std.assertEqual(std.format('%#.0e', [910.3]), '9.e+02') && -std.assertEqual(std.format('%#.0e', [900]), '9.e+02') && -std.assertEqual(std.format('%.3e', [1000000001]), '1.000e+09') && -// For very small numbers, Go and C++ differ in the accuracy of log(). -// The following test makes sure that we don't at least have a runtime error -// while calculating it. -std.assertEqual(std.type(std.format('%e', [3.94066e-324])), 'string') && - -// E -std.assertEqual(std.format('%E', [910]), '9.100000E+02') && -std.assertEqual(std.format('%.0lE', [910]), '9E+02') && -std.assertEqual(std.format('%#E', [-910]), '-9.100000E+02') && -std.assertEqual(std.format('%16E', [910]), ' 9.100000E+02') && -std.assertEqual(std.format('%016E', [910]), '00009.100000E+02') && -std.assertEqual(std.format('% E', [910]), ' 9.100000E+02') && -std.assertEqual(std.format('%- 16E', [910]), ' 9.100000E+02 ') && -std.assertEqual(std.format('% E', [-910]), '-9.100000E+02') && -std.assertEqual(std.format('%16.4E', [910.3]), ' 9.1030E+02') && -std.assertEqual(std.format('%+16.4E', [910.3]), ' +9.1030E+02') && -std.assertEqual(std.format('%+-16.4E', [910.3]), '+9.1030E+02 ') && -std.assertEqual(std.format('%-16.4E', [910.3]), '9.1030E+02 ') && -std.assertEqual(std.format('%#.0E', [910.3]), '9.E+02') && -std.assertEqual(std.format('%#.0E', [900]), '9.E+02') && -std.assertEqual(std.format('%.3E', [1000000001]), '1.000E+09') && - -// f -std.assertEqual(std.format('%f', [910]), '910.000000') && -std.assertEqual(std.format('%f', 0), '0.000000') && -std.assertEqual(std.format('%.0lf', [910]), '910') && -std.assertEqual(std.format('%#f', [-910]), '-910.000000') && -std.assertEqual(std.format('%12f', [910]), ' 910.000000') && -std.assertEqual(std.format('%012f', [910]), '00910.000000') && -std.assertEqual(std.format('% f', [910]), ' 910.000000') && -std.assertEqual(std.format('%- 12f', [910]), ' 910.000000 ') && -std.assertEqual(std.format('% f', [-910]), '-910.000000') && -std.assertEqual(std.format('%12.4f', [910.3]), ' 910.3000') && -std.assertEqual(std.format('%+12.4f', [910.3]), ' +910.3000') && -std.assertEqual(std.format('%+-12.4f', [910.3]), '+910.3000 ') && -std.assertEqual(std.format('%-12.4f', [910.3]), '910.3000 ') && -std.assertEqual(std.format('%#.0f', [910.3]), '910.') && -std.assertEqual(std.format('%#.0f', [910]), '910.') && -std.assertEqual(std.format('%.3f', [1000000001]), '1000000001.000') && -std.assertEqual(std.format('%f', [-0.1]), '-0.100000') && -std.assertEqual(std.format('%.1f', [0.99]), '1.0') && -std.assertEqual(std.format('%.1f', [1.95555]), '2.0') && -std.assertEqual(std.format('%.4f', [0.99995]), '1.0000') && - -// g -std.assertEqual(std.format('%#.3g', [1000000001]), '1.00e+09') && -std.assertEqual(std.format('%#.3g', [1100]), '1.10e+03') && -std.assertEqual(std.format('%#.3g', [1.1]), '1.10') && -std.assertEqual(std.format('%#.5g', [1000000001]), '1.0000e+09') && -std.assertEqual(std.format('%#.5g', [1100]), '1100.0') && -std.assertEqual(std.format('%#.5g', [110]), '110.00') && -std.assertEqual(std.format('%#.5g', [1.1]), '1.1000') && -std.assertEqual(std.format('%#.1g', [0.99]), '1.') && -std.assertEqual(std.format('%#.1g', [1.95555]), '2.') && -std.assertEqual(std.format('%#.4g', [0.99995]), '1.000') && -std.assertEqual(std.format('%#10.3g', [1000000001]), ' 1.00e+09') && -std.assertEqual(std.format('%#10.3g', [1100]), ' 1.10e+03') && -std.assertEqual(std.format('%#10.3g', [1.1]), ' 1.10') && -std.assertEqual(std.format('%#10.5g', [1000000001]), '1.0000e+09') && -std.assertEqual(std.format('%#10.5g', [1100]), ' 1100.0') && -std.assertEqual(std.format('%#10.5g', [110]), ' 110.00') && -std.assertEqual(std.format('%#10.5g', [1.1]), ' 1.1000') && -std.assertEqual(std.format('%.3g', [1000000001]), '1e+09') && -std.assertEqual(std.format('%.3g', [1100]), '1.1e+03') && -std.assertEqual(std.format('%.3g', [1.1]), '1.1') && -std.assertEqual(std.format('%.5g', [1000000001]), '1e+09') && -std.assertEqual(std.format('%.5g', [1100]), '1100') && -std.assertEqual(std.format('%.5g', [110]), '110') && -std.assertEqual(std.format('%.5g', [1.1]), '1.1') && -std.assertEqual(std.format('%10.3g', [1000000001]), ' 1e+09') && -std.assertEqual(std.format('%10.3g', [1100]), ' 1.1e+03') && -std.assertEqual(std.format('%10.3g', [1.1]), ' 1.1') && -std.assertEqual(std.format('%10.5g', [1000000001]), ' 1e+09') && -std.assertEqual(std.format('%10.5g', [1100]), ' 1100') && -std.assertEqual(std.format('%10.5g', [110]), ' 110') && -std.assertEqual(std.format('%10.5g', [1.1]), ' 1.1') && - -// G -std.assertEqual(std.format('%#.3G', [1000000001]), '1.00E+09') && -std.assertEqual(std.format('%#.3G', [1100]), '1.10E+03') && -std.assertEqual(std.format('%#.3G', [1.1]), '1.10') && -std.assertEqual(std.format('%#.5G', [1000000001]), '1.0000E+09') && -std.assertEqual(std.format('%#.5G', [1100]), '1100.0') && -std.assertEqual(std.format('%#.5G', [110]), '110.00') && -std.assertEqual(std.format('%#.5G', [1.1]), '1.1000') && -std.assertEqual(std.format('%#10.3G', [1000000001]), ' 1.00E+09') && -std.assertEqual(std.format('%#10.3G', [1100]), ' 1.10E+03') && -std.assertEqual(std.format('%#10.3G', [1.1]), ' 1.10') && -std.assertEqual(std.format('%#10.5G', [1000000001]), '1.0000E+09') && -std.assertEqual(std.format('%#10.5G', [1100]), ' 1100.0') && -std.assertEqual(std.format('%#10.5G', [110]), ' 110.00') && -std.assertEqual(std.format('%#10.5G', [1.1]), ' 1.1000') && -std.assertEqual(std.format('%.3G', [1000000001]), '1E+09') && -std.assertEqual(std.format('%.3G', [1100]), '1.1E+03') && -std.assertEqual(std.format('%.3G', [1.1]), '1.1') && -std.assertEqual(std.format('%.5G', [1000000001]), '1E+09') && -std.assertEqual(std.format('%.5G', [1100]), '1100') && -std.assertEqual(std.format('%.5G', [110]), '110') && -std.assertEqual(std.format('%.5G', [1.1]), '1.1') && -std.assertEqual(std.format('%10.3G', [1000000001]), ' 1E+09') && -std.assertEqual(std.format('%10.3G', [1100]), ' 1.1E+03') && -std.assertEqual(std.format('%10.3G', [1.1]), ' 1.1') && -std.assertEqual(std.format('%10.5G', [1000000001]), ' 1E+09') && -std.assertEqual(std.format('%10.5G', [1100]), ' 1100') && -std.assertEqual(std.format('%10.5G', [110]), ' 110') && -std.assertEqual(std.format('%10.5G', [1.1]), ' 1.1') && - -// lots together, also test % operator -std.assertEqual('%s[%05d]-%2x%2x%2x%c' % ['foo', 3991, 17, 18, 17, 100], 'foo[03991]-111211d') && - -// use of * -std.assertEqual('%*d' % [10, 8], '%10d' % [8]) && -std.assertEqual('%*.*f' % [10, 3, 1 / 3], '%10.3f' % [1 / 3]) && - -// Test mappings -std.assertEqual('%(name)s[%(id)05d]-%(a)2x%(b)2x%(c)2x%(x)c' % { name: 'foo', id: 3991, a: 17, b: 18, c: 17, x: 100 }, - 'foo[03991]-111211d') && - -local text = ||| - Lorem ipsum dolor sit amet, consectetur adipiscing elit. In pellentesque felis mi, et iaculis - tellus consectetur pretium. Integer ultricies ullamcorper arcu quis bibendum. Vivamus luctus nec - nulla id egestas. Vestibulum lectus nibh, lobortis sed gravida ac, pellentesque sit amet eros. - Nulla urna purus, ornare at iaculis eget, pharetra sed libero. Fusce a neque malesuada, - hendrerit ex nec, suscipit lorem. Aenean orci quam, placerat sed mollis ut, faucibus nec turpis. - Vivamus consectetur auctor vehicula. Nam eu risus sit amet eros mattis finibus nec ac enim. - Quisque velit metus, tristique in urna in, dictum gravida elit.%(a)s - - Aenean laoreet libero nunc. Cras molestie condimentum mollis. Nam quis leo sed enim vestibulum - dapibus faucibus eget elit. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Class - aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Praesent - cursus magna at urna viverra, eget venenatis ante sodales. In vitae magna sed lacus iaculis - porttitor eu vel nisl. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Ut vitae sapien - vel eros ultricies iaculis. Pellentesque et metus libero. Proin nec rhoncus est. Vivamus a - aliquam ipsum, ut vehicula nibh. Sed ac posuere dolor. -||| % { a: 'a' }; - -std.assertEqual(std.length(text), 1244) && - - -true diff --git a/ui-tests/jsonnet-0.20.0/functions.jsonnet b/ui-tests/jsonnet-0.20.0/functions.jsonnet deleted file mode 100644 index 1f62d95..0000000 --- a/ui-tests/jsonnet-0.20.0/functions.jsonnet +++ /dev/null @@ -1,60 +0,0 @@ -/* -Copyright 2015 Google Inc. All rights reserved. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -std.assertEqual((function(x) x * x)(5), 5 * 5) && - -// Correct self binding from within a function. -std.assertEqual({ x: 1, y: { x: 0, y: function() self.x }.y() }, { x: 1, y: 0 }) && - -local max = function(a, b) if a > b then a else b; -local inv(d) = if d != 0 then 1 / d else 0; - -std.assertEqual(max(4, 8), 8) && -std.assertEqual(inv(0.5), 2) && - -local is_even = function(n) if n == 0 then true else is_odd(n - 1), - is_odd = function(n) if n == 1 then true else is_even(n - 1); - -std.assertEqual(is_even(42), true) && -std.assertEqual(is_odd(41), true) && - -std.assertEqual((function(a, b) [a, b])(b=1, a=2), [2, 1]) && -std.assertEqual((function(a, b=2) [a, b])(3), [3, 2]) && - -// Mutually recursive default arguments. -std.assertEqual((function(a=[1, b[1]], b=[a[0], 2]) [a, b])(), [[1, 2], [1, 2]]) && -std.assertEqual((local a = 'no1', b = 'no2'; function(a=[1, b[1]], b=[a[0], 2]) [a, b])(), - [[1, 2], [1, 2]]) && -std.assertEqual((local x = 3; function(a=[x, b[1]], b=[a[0], 2]) [a, b])(), - [[3, 2], [3, 2]]) && -std.assertEqual({ g: 3, f(a=[self.g, b[1]], b=[a[0], 2]): [a, b] }.f(), - [[3, 2], [3, 2]]) && - -local url(host, port=80, protocol='http', url='%s://%s:%d/' % [protocol, host, port]) = url; - -std.assertEqual(url('myhost'), 'http://myhost:80/') && -std.assertEqual(url('mybucket', 8080, protocol='gs'), 'gs://mybucket:8080/') && -std.assertEqual(url(null, url='wat'), 'wat') && - -local test(a=error 'Need a', alt="'" + a + "'") = alt; -std.assertEqual(test(a='Q'), "'Q'") && -std.assertEqual(test(alt='|Q|'), '|Q|') && - -local X = 3; -std.assertEqual((function(X=4) X)(), 4) && -std.assertEqual((function(X=4, Y=X) Y)(), 4) && - -true diff --git a/ui-tests/jsonnet-0.20.0/invariant.jsonnet b/ui-tests/jsonnet-0.20.0/invariant.jsonnet deleted file mode 100644 index aed94c2..0000000 --- a/ui-tests/jsonnet-0.20.0/invariant.jsonnet +++ /dev/null @@ -1,76 +0,0 @@ -/* -Copyright 2015 Google Inc. All rights reserved. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -std.assertEqual({}, { assert true, assert true }) && -std.assertEqual({}, { assert true, assert 1 == 1 }) && -std.assertEqual({ assert true, assert 1 == 1 }, {}) && -std.assertEqual({ assert 1 == 1 }, {}) && -std.assertEqual({ assert true, f: 1 }.f, 1) && -std.assertEqual({ assert self.f == 1, f: 1 }.f, 1) && -std.assertEqual({ assert self.f == g, f: 1, local g = 1 }.f, 1) && - -local x = { assert x.f == y.f, f: 1 }, - y = { assert x.f == y.f, f: 1 }; - -std.assertEqual(x.f, y.f) && - - -local Mixin1 = { - assert self.x > 0, - x: super.x, -}; - -std.assertEqual({ x: 1 } + Mixin1, { x: 1 }) && - -local Mixin2 = { - assert self.x > super.x, - x+: self.increment, - increment:: 1, -}; - -std.assertEqual({ x: 1 } + Mixin2, { x: 2 }) && - -local Template = { - assert self == output, - local template = self, - local output = { - str: '%d %d' % [template.x, template.y], - }, - x:: error 'Must set x', - y:: error 'Must set y', - - str: output.str, -}; - -std.assertEqual(Template { x: 1, y: 2 }, { str: '1 2' }) && - -std.assertEqual(std.type({ assert false }), 'object') && - -std.assertEqual(std.length({ assert false }), 0) && - -std.assertEqual(std.objectHas({ assert false, f: 3 }, 'f'), true) && -std.assertEqual(std.objectHas({ assert false, f: 3, g:: 3 }, 'g'), false) && -std.assertEqual(std.objectHas({ assert false, f: 3, g:: 3 }, 'h'), false) && - -std.assertEqual(std.objectFields({ assert false, f: 3, g:: 3 }), ['f']) && - -std.assertEqual(std.objectHasAll({ assert false, f: 3 }, 'f'), true) && -std.assertEqual(std.objectHasAll({ assert false, f: 3, g:: 3 }, 'g'), true) && -std.assertEqual(std.objectHasAll({ assert false, f: 3, g:: 3 }, 'h'), false) && - -std.assertEqual(std.objectFieldsAll({ assert false, f: 3, g:: 3 }), ['f', 'g']) && - -true diff --git a/ui-tests/jsonnet-0.20.0/local.jsonnet b/ui-tests/jsonnet-0.20.0/local.jsonnet deleted file mode 100644 index eb82a14..0000000 --- a/ui-tests/jsonnet-0.20.0/local.jsonnet +++ /dev/null @@ -1,36 +0,0 @@ -/* -Copyright 2015 Google Inc. All rights reserved. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -std.assertEqual(local x = 3; x, 3) && -std.assertEqual(local x = error 'foo'; 3, 3) && -std.assertEqual(local x = y, y = 3; x, 3) && - -local x = [x, y, 'foo'], y = [y, 'bar', x]; -std.assertEqual(x[1][1], 'bar') && -std.assertEqual(y[0][2][2], 'foo') && - -local x = { '0': 'zero', '1': y['1'] }, - y = { '0': x['0'], '1': 'one' }; - -std.assertEqual(x, y) && - -local x = ['zero', y[1]], - y = [x[0], 'one']; - -std.assertEqual(x, y) && - - -true diff --git a/ui-tests/jsonnet-0.20.0/object.jsonnet b/ui-tests/jsonnet-0.20.0/object.jsonnet deleted file mode 100644 index 096bac4..0000000 --- a/ui-tests/jsonnet-0.20.0/object.jsonnet +++ /dev/null @@ -1,114 +0,0 @@ -/* -Copyright 2015 Google Inc. All rights reserved. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -std.assertEqual({}, {}) && -std.assertEqual({ 'x': 1 }, { 'x': 1 }) && -std.assertEqual({ '': 1 }, { '': 1 }) && -std.assertEqual({ x: 1, y: 2 }.y, 2) && -std.assertEqual({ x: 1, y: 2 }["y"], 2) && -std.assertEqual({ x: error "foo", y: 2 }.y, 2) && -std.assertEqual({ x: 1, y: 2 } + { z: 3 }, { x: 1, y: 2, z: 3 }) && -std.assertEqual({ x: 1, y: 2 } + { y: 3 }, { x: 1, y: 3 }) && -std.assertEqual({ x: 1, y: 2 } + { y+: 3 }, { x: 1, y: 5 }) && -std.assertEqual({ a: { x: 1 }, b: { x: 2 } } + { a+: { y: 3 }, b: { x: 3 } }, { a: { x: 1, y: 3 }, b: { x: 3 } }) && - -std.assertEqual({ x: 1, y: 2 } == { x: 1, y: 2 }, true) && -std.assertEqual({ x: 1, y: 2 } == { x: 1, y: 2, z: 3 }, false) && -std.assertEqual({ x: 1, y: 2 } != { x: 1, y: 2 }, false) && -std.assertEqual({ x: 1, y: 2 } != { x: 1, y: 2, z: 3 }, true) && - -std.assertEqual({ f(x, y, z): x, y: self.f(1, 2, 3) }.y, 1) && -std.assertEqual({ ["f"](x, y, z):: x, "y"(x): self.f(x, 2, 3), z: self.y(4) }.z, 4) && - -// Object Local - -std.assertEqual({ local foo = 3, local bar(n) = foo + n, x: foo, y: foo + bar(1) }, { x: 3, y: 7 }) && -std.assertEqual({ local foo = bar(3)[1], local bar(n) = [foo, n], x: foo, y: [foo] + bar(3) }, { x: 3, y: [3, 3, 3] }) && - - -// Computed field name -std.assertEqual(local f = "x"; { [f]: 1 }, { x: 1 }) && -std.assertEqual({ [pair[0]]: pair[1] for pair in [["x", 1], ["y", 2]] }, { x: 1, y: 2 }) && -std.assertEqual(local t = { a: 1, b: 2, c: null, d: 4 }; { [x]: t[x] for x in [y for y in ["a", "b", "c", "d"] if t[y] != null] }, { a: 1, b: 2, d: 4 }) && - -// Comprehension object -std.assertEqual(local x = 10; { ["" + x]: x for x in [x, x + 1, x + 2] }, { "10": 10, "11": 11, "12": 12 }) && -std.assertEqual(local x = "foo"; { local x = "bar", [x]: 1 }, { foo: 1 }) && -std.assertEqual({ [x + ""]: if x == 1 then 1 else x + $["1"] for x in [1, 2, 3] }, { "1": 1, "2": 3, "3": 4 }) && - -std.assertEqual(local x = "baz"; { local x = "bar", [x]: x for x in ["foo"] }, { foo: "bar" }) && - - -std.assertEqual({ f: "foo", g: { [self.f]: 7 } }, { f: "foo", g: { foo: 7 } }) && - -std.assertEqual({ [k]: null for k in [] }, {}) && -std.assertEqual({ [null]: "test" for k in [1] }, {}) && -std.assertEqual({ [null]: "test" }, {}) && - -std.assertEqual({ ["" + k]: k for k in [1, 2, 3] }, { "1": 1, "2": 2, "3": 3 }) && -std.assertEqual({ ["" + (k + 1)]: (k + 1) for k in [0, 1, 2] }, { ["" + k]: k for k in [1, 2, 3] }) && -std.assertEqual({ ["" + k]: k for k in [1, 2, 3] }, { "1": 1, "2": 2, "3": 3 }) && -std.assertEqual({ [x + ""]: x + foo, local foo = 3 for x in [1, 2, 3] }, { "1": 4, "2": 5, "3": 6 }) && - -// Test for #791 -std.assertEqual({ [x]: true for x in ['\\k'] }, { '\\k': true }) && - - -local obj = { - f14true: { x: 1, y: 4, z: true }, - f14false: { x: 1, y: 4, z: false }, - f16true: { x: 1, y: 6, z: true }, - f16false: { x: 1, y: 6, z: false }, - f26true: { x: 2, y: 6, z: true }, - f26false: { x: 2, y: 6, z: false }, - f36true: { x: 3, y: 6, z: true }, - f36false: { x: 3, y: 6, z: false }, -}; - -std.assertEqual(obj, { ["f" + x + y + z]: { x: x, y: y, z: z } for x in [1, 2, 3] for y in [1, 4, 6] if x + 2 < y for z in [true, false] }) && - -std.assertEqual({ f: { foo: 7, bar: 1 } { [self.name]+: 3, name:: "foo" }, name:: "bar" }, - { f: { foo: 7, bar: 4 } }) && - -std.assertEqual({ name:: "supername" } { name:: "selfname", f: { wrongname: 7, supername: 1, name:: "wrongname" } { [super.name]+: 3 } }, - { f: { wrongname: 7, supername: 4 } }) && - -std.assertEqual({} + { f+: 3 }, { f: 3 }) && -std.assertEqual({} + { f+: { g+: "foo" } }, { f: { g: "foo" } }) && -std.assertEqual({} + { f+: [3] }, { f: [3] }) && - -std.assertEqual({ f+: 3 }, { f: 3 }) && -std.assertEqual({ f+: { g+: "foo" } }, { f: { g: "foo" } }) && -std.assertEqual({ f+: [3] }, { f: [3] }) && - -// Ensure that e in super is handled correctly during the +: desugaring, because it moves -// into a different object scope: -std.assertEqual( - { opt:: true, f: { y: 5 } } + { f+: { [if "opt" in super then "x" else "y"]+: 3 } }, - { f: { x: 3, y: 5 } } -) && - -std.assertEqual({ x: 1 } + { a: "x" in super, b: "y" in super }, { x: 1, a: true, b: false }) && -std.assertEqual({ x:: 1 } + { a: "x" in super, b: "y" in super }, { a: true, b: false }) && - -std.assertEqual("x" in { x: 3 }, true) && -std.assertEqual("x" in { y: 3 }, false) && - -std.assertEqual({ x: 1, a: "x" in self, b: "y" in self }, { x: 1, a: true, b: false }) && -std.assertEqual({ x:: 1, a: "x" in self, b: "y" in self }, { a: true, b: false }) && -std.assertEqual({ f: "f" in self }, { f: true }) && - -true diff --git a/ui-tests/jsonnet-0.20.0/oop.jsonnet b/ui-tests/jsonnet-0.20.0/oop.jsonnet deleted file mode 100644 index 8347f6a..0000000 --- a/ui-tests/jsonnet-0.20.0/oop.jsonnet +++ /dev/null @@ -1,89 +0,0 @@ -/* -Copyright 2015 Google Inc. All rights reserved. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -// basic self -std.assertEqual({ x: 1, y: self.x }.y, 1) && -std.assertEqual(({ x: 1, y: self.x } + {}).y, 1) && - -// self as object -std.assertEqual({ x: 1, y: self }.y.y.x, 1) && -std.assertEqual(({ x: 1, y: self } + {}).y.y.x, 1) && - -// self bound correctly in superobjects -std.assertEqual(({ x: 1, y: self.x } + { x: 2 }).y, 2) && - -// basic super -std.assertEqual(({ x: 1, y: self.x } + { x: 2, y: super.y + 1, z: super.y }), { x: 2, y: 3, z: 2 }) && - -// self bound correctly in super objects when calling via super -std.assertEqual(({ x: self.x } + { x: 2, y: super.x }).y, 2) && - -// super up 2 levels (note + is left associative) -std.assertEqual({ x: 1 } + { x: 2, y: super.x } + { x: 3, z: super.x }, { x: 3, y: 1, z: 2 }) && - -// variables bound statically in superobjects -std.assertEqual((local z = 3; { x: z }) + (local z = 4; { x: z, y: super.x }), { x: 4, y: 3 }) && - -// static binding in superobject -std.assertEqual(local A = { a1: 1, a2: self.a1, a3: A.a2 }; - A { a1: 2, a2: super.a2 + 1, b1: super.a2, b2: super.a3 }, { a1: 2, a2: 3, a3: 1, b1: 2, b2: 1 }) && - - -// multiple inheritance -std.assertEqual({ x: 1, y: self.x } + ({ x: 2 } + { x: 3, y: 5, z: super.y }), { x: 3, y: 5, z: 3 }) && - -// multiple inheritance of empty middle - -std.assertEqual({ x: 1 } + ({} + { y: super.x }), { x: 1, y: 1 }) && - - -// grandparents with super visiting all leaves -local A = { name: 'A' }, - B = { name: 'B', sB: super.name }, - C = { name: 'C', sC: super.name }, - D = { name: 'D', sD: super.name }; - -std.assertEqual((A + B) + (C + D), { name: 'D', sB: 'A', sC: 'B', sD: 'C' }) && - -// Outer variable -local a = { - d: 0, - local outer = self, - b: { c: outer.d + 1, c2: a.d + 1 }, -}; - -local e = a.b { d: 4 }; -local e2 = (a { d: 4 }).b; - -std.assertEqual(e.c, 1) && -std.assertEqual(e.c2, 1) && -std.assertEqual(e2.c, 5) && -std.assertEqual(e2.c2, 1) && - -// $ is late-bound -std.assertEqual(({ x: 1, y: { a: $.x } } + { x: 2 }).y.a, 2) && - -// DAG -std.assertEqual({ x: 1, y: 2 } + (local A = { x: super.y, y: super.x }; A + A), { x: 1, y: 2 }) && - - -// Object composition: inheritance -std.assertEqual(local f = 'x'; { x: 2 } + { [f]: 1 }, { x: 1 }) && -// more object composition -std.assertEqual({ x: 3, z: 4 } + { [pair[0]]: pair[1] for pair in [['x', 1], ['y', 2]] }, { x: 1, y: 2, z: 4 }) && -// more inheritance and object composition -std.assertEqual({} + { [k]: k + '_' for k in ['x', 'y', 'foo', 'foobar'] }, { x: 'x_', y: 'y_', foo: 'foo_', foobar: 'foobar_' }) && -true diff --git a/ui-tests/jsonnet-0.20.0/oop_extra.jsonnet b/ui-tests/jsonnet-0.20.0/oop_extra.jsonnet deleted file mode 100644 index 3f5d824..0000000 --- a/ui-tests/jsonnet-0.20.0/oop_extra.jsonnet +++ /dev/null @@ -1,57 +0,0 @@ -/* -Copyright 2015 Google Inc. All rights reserved. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -// Simple super -std.assertEqual(({ x: 0, y: self.x } + { x: 1, y: super.y }).y, 1) && - -// returning self -std.assertEqual(({ x: 0, y: self.x } + { x: 1, z: self }).z.y, 1) && - -// extending self on the right -std.assertEqual(({ x: 0, y: self.x } + { x: 1, z: (self + {}).y }).z, 1) && -std.assertEqual(({ x: 0, y: self.x } + { x: 1, z: (self + {}) }).z.y, 1) && - -// extending self on the right has dynamic binding -std.assertEqual(({ x: 0, y: self.x } + { x: 2, z: (self + { x: 1 }).y }).z, 1) && -std.assertEqual(({ x: 0, y: self.x } + { x: 2, z: (self + { x: 1 }) }).z.y, 1) && - -std.assertEqual(({ x: 0, y: self.x } + { x: 2, w: 1, z: (self + { x: super.w }).y }).z, 1) && -std.assertEqual(({ x: 0, y: self.x } + { x: 2, w: 1, z: (self + { x: super.w }) }).z.y, 1) && -std.assertEqual(({ x: 0, y: self.x } + { x: 2, w: 1, z: (self + { x: self.w }).y }).z, 1) && -std.assertEqual(({ x: 0, y: self.x } + { x: 2, w: 1, z: (self + { x: self.w }) }).z.y, 1) && - -// self + self -std.assertEqual(({ x: 1, y: super.x } + { z: (self + self).y }).z, 1) && - -// extending self on the left -std.assertEqual(({ x: 0, y: self.x } + { x: 1, z: ({} + self).y }).z, 1) && -std.assertEqual(({ x: 0, y: self.x } + { x: 1, z: ({} + self) }).z.y, 1) && - -std.assertEqual(({ x: 1, z: ({ x: 0, y: self.x } + self).y }).z, 1) && -std.assertEqual(({ x: 1, z: ({ x: 0, y: self.x } + self) }).z.y, 1) && - -std.assertEqual(({ x: 0, z: ({ w: 1, x: 2, y: self.w } + self).y }).z, 1) && -std.assertEqual(({ x: 0, z: ({ w: 1, x: 2, y: self.w } + self) }).z.y, 1) && - -std.assertEqual(({ x: 1, w: self.x, z: ({ x: 2, y: self.w } + self).y }).z, 1) && -std.assertEqual(({ x: 1, w: self.x, z: ({ x: 2, y: self.w } + self) }).z.y, 1) && - - -// extra - -std.assertEqual({ a: ({ b: self.c, c: 1 } + self).b }.a, 1) && - -true diff --git a/ui-tests/jsonnet-0.20.0/parsing_edge_cases.jsonnet b/ui-tests/jsonnet-0.20.0/parsing_edge_cases.jsonnet deleted file mode 100644 index d706ca3..0000000 --- a/ui-tests/jsonnet-0.20.0/parsing_edge_cases.jsonnet +++ /dev/null @@ -1,27 +0,0 @@ -/* -Copyright 2018 Google Inc. All rights reserved. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -local obj = { - default_x: 10, - f(x=$.default_x):: x * 2, - - test1: -$.default_x, - test2: --3, -}; - -std.assertEqual(obj.f(), 20) && -std.assertEqual(obj.test1, -10) && -std.assertEqual(obj.test2, 3) diff --git a/ui-tests/jsonnet-0.20.0/precedence.jsonnet b/ui-tests/jsonnet-0.20.0/precedence.jsonnet deleted file mode 100644 index 9e23565..0000000 --- a/ui-tests/jsonnet-0.20.0/precedence.jsonnet +++ /dev/null @@ -1,44 +0,0 @@ -/* -Copyright 2015 Google Inc. All rights reserved. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -std.assertEqual(1 + 2 * 3, 7) && -std.assertEqual(1 + 2 * 3, 7) && -std.assertEqual(+1 + 2 * 3, 7) && -std.assertEqual(-1 + 2 * 3, 5) && -std.assertEqual(3 + 2 / 2, 4) && -std.assertEqual(6 - 3 + 2, 5) && -std.assertEqual(6 / 3 / 2, 1) && -std.assertEqual(6 / 3 / 2, 1) && -std.assertEqual(6 / 3 * 2, 4) && -std.assertEqual(6 / 3 % 2, 0) && -std.assertEqual(1 + 2 << 1, 6) && -std.assertEqual(42 << 1 >> 1, 42) && -std.assertEqual(42 > 40 + 2, false) && -std.assertEqual(42 >= 40 + 2, true) && -std.assertEqual(42 < 40 + 2, false) && -std.assertEqual(42 <= 40 + 2, true) && -std.assertEqual(1 + 1 == 2, true) && -std.assertEqual(1 | 3 & 6, 3) && -std.assertEqual(1 | 3 & 6 ^ 2, 1) && -std.assertEqual(false && true || false, false) && -std.assertEqual(!false && true || false, true) && -std.assertEqual(true && false || false, false) && -std.assertEqual(if true then 1 else 2 + 3, 1) && -std.assertEqual(':' + if true then 'foo' else error 'bar' + 'baz', ':foo') && -std.assertEqual(':' + if true then 'foo' else function() 'bar' + 'baz', ':foo') && -std.assertEqual(20 * local x = 6; x + 4, 200) && - -true diff --git a/ui-tests/jsonnet-0.20.0/recursive_function.jsonnet b/ui-tests/jsonnet-0.20.0/recursive_function.jsonnet deleted file mode 100644 index 3d3e0b9..0000000 --- a/ui-tests/jsonnet-0.20.0/recursive_function.jsonnet +++ /dev/null @@ -1,37 +0,0 @@ -/* -Copyright 2015 Google Inc. All rights reserved. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -local fibonacci(n) = - if n <= 1 then - 1 - else - fibonacci(n - 1) + fibonacci(n - 2); - -std.assertEqual(fibonacci(15), 987) && - -// Tail recursive call -local sum(x, v) = - if x <= 0 then - v - else - sum(x - 1, x + v) tailstrict; - -local sz = 10000; -std.assertEqual(sum(sz, 0), sz * (sz + 1) / 2) && - -std.assertEqual(local x() = 3; x() tailstrict, 3) && - -true diff --git a/ui-tests/jsonnet-0.20.0/recursive_object.jsonnet b/ui-tests/jsonnet-0.20.0/recursive_object.jsonnet deleted file mode 100644 index fe289f0..0000000 --- a/ui-tests/jsonnet-0.20.0/recursive_object.jsonnet +++ /dev/null @@ -1,23 +0,0 @@ -/* -Copyright 2015 Google Inc. All rights reserved. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -local Fib = { - n: 1, - local outer = self, - r: if self.n <= 1 then 1 else (Fib { n: outer.n - 1 }).r + (Fib { n: outer.n - 2 }).r, -}; - -std.assertEqual((Fib { n: 15 }).r, 987) diff --git a/ui-tests/jsonnet-0.20.0/slice.sugar.jsonnet b/ui-tests/jsonnet-0.20.0/slice.sugar.jsonnet deleted file mode 100644 index bfd0029..0000000 --- a/ui-tests/jsonnet-0.20.0/slice.sugar.jsonnet +++ /dev/null @@ -1,178 +0,0 @@ -/* -Copyright 2015 Google Inc. All rights reserved. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -local arr = std.range(0, 5); -local str = '012345'; -local a = 2; -local b = 4; - -local arrCases = [ - { - input: arr[2:4], - output: [2, 3], - }, - { - input: arr[2:4:1], - output: [2, 3], - }, - { - input: arr[:4], - output: [0, 1, 2, 3], - }, - { - input: arr[2:], - output: [2, 3, 4, 5], - }, - { - input: arr[:], - output: arr, - }, - { - input: arr[:1000], - output: arr, - }, - { - input: arr[::], - output: arr, - }, - { - input: arr[1::], - output: [1, 2, 3, 4, 5], - }, - { - input: arr[(1)::], - output: [1, 2, 3, 4, 5], - }, - { - input: arr[1::2], - output: [1, 3, 5], - }, - { - input: arr[(1)::2], - output: [1, 3, 5], - }, - { - input: arr[::2], - output: [0, 2, 4], - }, - { - input: arr[:0:], - output: [], - }, - { - input: arr[:(0):], - output: [], - }, - { - input: arr[a:b], - output: [2, 3 ], - }, - { - input: arr[a:b + 1], - output: [2, 3, 4], - }, - { - input: arr[2:1000], - output: [2, 3, 4, 5], - }, - { - input: (arr)[2:1000], - output: [2, 3, 4, 5], - }, - -]; - -local strCases = [ - { - input: str[2:4], - output: '23', - }, - { - input: str[2:4:1], - output: '23', - }, - { - input: str[:4], - output: '0123', - }, - { - input: str[2:], - output: '2345', - }, - { - input: str[:], - output: str, - }, - { - input: str[:1000], - output: str, - }, - { - input: str[::], - output: str, - }, - { - input: str[1::], - output: '12345', - }, - { - input: str[(1)::], - output: '12345', - }, - { - input: str[1::2], - output: '135', - }, - { - input: str[(1)::2], - output: '135', - }, - { - input: str[::2], - output: '024', - }, - { - input: str[:0:], - output: '', - }, - { - input: str[:(0):], - output: '', - }, - { - input: str[a:b], - output: '23', - }, - { - input: str[a:b + 1], - output: '234', - }, - { - input: str[2:1000], - output: '2345', - }, - { - input: (str)[2:1000], - output: '2345', - }, -]; - -std.foldl( - function(bool, case) - bool && std.assertEqual(case.input, case.output), - arrCases + strCases, - true, -) diff --git a/ui-tests/jsonnet-0.20.0/text_block.jsonnet b/ui-tests/jsonnet-0.20.0/text_block.jsonnet deleted file mode 100644 index b57eb49..0000000 --- a/ui-tests/jsonnet-0.20.0/text_block.jsonnet +++ /dev/null @@ -1,126 +0,0 @@ -/* -Copyright 2015 Google Inc. All rights reserved. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -// Golden -local bash_golden = std.lines([ - "#!/usr/bin/env bash", - "if [ $# -lt 1 ] ; then", - " echo \"No arguments!\"", - "else", - " echo \"$# arguments!\"", - "fi", -]); - -// Soft tabs -local bash_soft = ||| - #!/usr/bin/env bash - if [ $# -lt 1 ] ; then - echo "No arguments!" - else - echo "$# arguments!" - fi -|||; -std.assertEqual(bash_golden, bash_soft) && - -// Hard tabs -local bash_hard = ||| - #!/usr/bin/env bash - if [ $# -lt 1 ] ; then - echo "No arguments!" - else - echo "$# arguments!" - fi -|||; -std.assertEqual(bash_golden, bash_hard) && - -// Mixed tabs -local bash_mixed = ||| - #!/usr/bin/env bash - if [ $# -lt 1 ] ; then - echo "No arguments!" - else - echo "$# arguments!" - fi -|||; -std.assertEqual(bash_golden, bash_mixed) && - - -// More indent -local str1 = ||| - text - |||; - -std.assertEqual(str1, "text\n") && - - -// Escape chars -local str1 = ||| - \n - |||; - -std.assertEqual(str1, "\\n\n") && - - -// Blank line with trailing whitespace -local blank_line1 = ||| - foo - - bar - |||; - -std.assertEqual(blank_line1, "foo\n\nbar\n") && - - -// Blank line no trailing whitespace -local blank_line2 = ||| - foo - - bar - |||; - -std.assertEqual(blank_line2, "foo\n\nbar\n") && - -// Initial blank line -local blank_line3 = ||| - - foo - |||; - -std.assertEqual(blank_line3, "\nfoo\n") && - -// Interaction with operators (1) -local op1 = "foo"+||| - foo -|||; - -std.assertEqual(op1, "foofoo\n") && - -// Interaction with operators (2) -local op2 = "foo"<||| - foo -|||; - -std.assertEqual(op2, true) && - -// whitespace after ||| -local whitespace_after = ||| - foo -|||; - -std.assertEqual(whitespace_after, "foo\n") && - - -true diff --git a/ui-tests/jsonnet-0.20.0/verbatim_strings.jsonnet b/ui-tests/jsonnet-0.20.0/verbatim_strings.jsonnet deleted file mode 100644 index 8e80216..0000000 --- a/ui-tests/jsonnet-0.20.0/verbatim_strings.jsonnet +++ /dev/null @@ -1,24 +0,0 @@ -/* -Copyright 2017 Google Inc. All rights reserved. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - - -std.assertEqual(@"c:\negative""", 'c:\\negative"') && -std.assertEqual(@'c:\negative''', "c:\\negative'") && - -std.assertEqual({ @"c:\negative""": 1 }, { 'c:\\negative"': 1 }) && -std.assertEqual({ @'c:\negative''': 1 }, { "c:\\negative'": 1 }) && - -true