Skip to content

Commit 39f8dfa

Browse files
committed
Add availableSince for every stdlib function and require it in a test so we don't get any more gaps
1 parent 5e70ed7 commit 39f8dfa

File tree

6 files changed

+660
-114
lines changed

6 files changed

+660
-114
lines changed

doc/_stdlib_gen/run_tests.sh

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
#!/usr/bin/env bash
2+
3+
# Copyright 2015 Google Inc. All rights reserved.
4+
#
5+
# Licensed under the Apache License, Version 2.0 (the "License");
6+
# you may not use this file except in compliance with the License.
7+
# You may obtain a copy of the License at
8+
#
9+
# http://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# Unless required by applicable law or agreed to in writing, software
12+
# distributed under the License is distributed on an "AS IS" BASIS,
13+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
# See the License for the specific language governing permissions and
15+
# limitations under the License.
16+
17+
TEST_SUITE_NAME="${TEST_SUITE_NAME:-$0}"
18+
19+
cd $(dirname $0)
20+
21+
JSONNET_BIN="${JSONNET_BIN:-../../jsonnet}"
22+
23+
source ../../test_suite/tests.source
24+
25+
init
26+
27+
shopt -s nullglob
28+
29+
FAILED=0
30+
SUCCESS=0
31+
32+
test_eval "$JSONNET_BIN" "stdlib-content-test.jsonnet" 0 "true" "PLAIN"
33+
34+
deinit
35+
36+
if [ "$FAILED" -eq 0 ] ; then
37+
echo "$TEST_SUITE_NAME: All $EXECUTED tests executed correctly."
38+
else
39+
echo "$TEST_SUITE_NAME: $FAILED / $EXECUTED tests failed."
40+
exit 1
41+
fi
42+
43+
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
local stdlib_content = import 'stdlib-content.jsonnet';
2+
3+
std.all([
4+
if !std.objectHas(field, 'availableSince') then
5+
error 'No availableSince field for std.%s' % field.name
6+
else if field.availableSince[0] == 'v' then
7+
error 'availableSince field for std.%s should not begin with a "v" (got %s)'
8+
% [field.name, field.availableSince]
9+
else
10+
true
11+
for group in stdlib_content.groups
12+
for field in group.fields
13+
])

0 commit comments

Comments
 (0)