mirror of
https://github.com/google/go-jsonnet.git
synced 2025-09-28 17:01:02 +02:00
Fix strip definition
Co-authored-by: Tom Fenech <tomjwfenech@gmail.com>
This commit is contained in:
parent
bead95bfa6
commit
ce76155e09
@ -78,9 +78,9 @@ func prepareStdlib(g *typeGraph) {
|
|||||||
"findSubstr": g.newSimpleFuncType(arrayOfNumber, "pat", "str"),
|
"findSubstr": g.newSimpleFuncType(arrayOfNumber, "pat", "str"),
|
||||||
"startsWith": g.newSimpleFuncType(boolType, "a", "b"),
|
"startsWith": g.newSimpleFuncType(boolType, "a", "b"),
|
||||||
"endsWith": g.newSimpleFuncType(boolType, "a", "b"),
|
"endsWith": g.newSimpleFuncType(boolType, "a", "b"),
|
||||||
"stripChars": g.newSimpleFuncType(stringType, "chars"),
|
"stripChars": g.newSimpleFuncType(stringType, "str", "chars"),
|
||||||
"lstripChars": g.newSimpleFuncType(stringType, "chars"),
|
"lstripChars": g.newSimpleFuncType(stringType, "str", "chars"),
|
||||||
"rstripChars": g.newSimpleFuncType(stringType, "chars"),
|
"rstripChars": g.newSimpleFuncType(stringType, "str", "chars"),
|
||||||
"split": g.newSimpleFuncType(arrayOfString, "str", "c"),
|
"split": g.newSimpleFuncType(arrayOfString, "str", "c"),
|
||||||
"splitLimit": g.newSimpleFuncType(arrayOfString, "str", "c", "maxsplits"),
|
"splitLimit": g.newSimpleFuncType(arrayOfString, "str", "c", "maxsplits"),
|
||||||
"strReplace": g.newSimpleFuncType(stringType, "str", "from", "to"),
|
"strReplace": g.newSimpleFuncType(stringType, "str", "from", "to"),
|
||||||
|
3
testdata/stdlib_smoke_test.golden
vendored
3
testdata/stdlib_smoke_test.golden
vendored
@ -96,6 +96,7 @@
|
|||||||
"length": 0,
|
"length": 0,
|
||||||
"lines": "a\nb\nc\n",
|
"lines": "a\nb\nc\n",
|
||||||
"log": 1.6094379124341003,
|
"log": 1.6094379124341003,
|
||||||
|
"lstripChars": "bbbbcccc",
|
||||||
"makeArray": [
|
"makeArray": [
|
||||||
0,
|
0,
|
||||||
1,
|
1,
|
||||||
@ -155,6 +156,7 @@
|
|||||||
5
|
5
|
||||||
],
|
],
|
||||||
"repeat": "foofoofoo",
|
"repeat": "foofoofoo",
|
||||||
|
"rstripChars": "aaabbbb",
|
||||||
"set": [
|
"set": [
|
||||||
[
|
[
|
||||||
1,
|
1,
|
||||||
@ -238,6 +240,7 @@
|
|||||||
"a",
|
"a",
|
||||||
"h"
|
"h"
|
||||||
],
|
],
|
||||||
|
"stripChars": "bbbb",
|
||||||
"substr": "s",
|
"substr": "s",
|
||||||
"tan": -3.3805150062465854,
|
"tan": -3.3805150062465854,
|
||||||
"thisFile": "testdata/stdlib_smoke_test",
|
"thisFile": "testdata/stdlib_smoke_test",
|
||||||
|
3
testdata/stdlib_smoke_test.jsonnet
vendored
3
testdata/stdlib_smoke_test.jsonnet
vendored
@ -61,6 +61,9 @@
|
|||||||
findSubstr: std.findSubstr(pat="test", str="test test"),
|
findSubstr: std.findSubstr(pat="test", str="test test"),
|
||||||
startsWith: std.startsWith(a="jsonnet", b="json"),
|
startsWith: std.startsWith(a="jsonnet", b="json"),
|
||||||
endsWith: std.endsWith(a="jsonnet", b="sonnet"),
|
endsWith: std.endsWith(a="jsonnet", b="sonnet"),
|
||||||
|
stripChars: std.stripChars(str="aaabbbbcccc", chars="ac"),
|
||||||
|
lstripChars: std.lstripChars(str="aaabbbbcccc", chars="a"),
|
||||||
|
rstripChars: std.rstripChars(str="aaabbbbcccc", chars="c"),
|
||||||
split: std.split(str="a,b,c", c=","),
|
split: std.split(str="a,b,c", c=","),
|
||||||
splitLimit: std.splitLimit(str="a,b,c", c=",", maxsplits=1),
|
splitLimit: std.splitLimit(str="a,b,c", c=",", maxsplits=1),
|
||||||
strReplace: std.strReplace(str="aaa", from="aa", to="bb"),
|
strReplace: std.strReplace(str="aaa", from="aa", to="bb"),
|
||||||
|
Loading…
x
Reference in New Issue
Block a user