this repo has no description
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

pkg: add some tests that pick defaults in builtins

These tests should not change with an upcoming
CL that to support pkg.Schema.

Issue #2471

Signed-off-by: Marcel van Lohuizen <mpvl@gmail.com>
Change-Id: Ic941ea65432dfdd23743692c1e1efefc8de9da95
Reviewed-on: https://review.gerrithub.io/c/cue-lang/cue/+/1199623
TryBot-Result: CUEcueckoo <cueckoo@cuelang.org>
Unity-Result: CUE porcuepine <cue.porcuepine@gmail.com>
Reviewed-by: Daniel Martí <mvdan@mvdan.cc>

+102
+16
cue/interpreter/wasm/testdata/cue/default.txtar
··· 1 + # Check that default values are resolved correctly. 2 + 3 + exec cue eval -E --out cue 4 + cmp stdout out/wasm 5 + 6 + -- a.cue -- 7 + @extern("wasm") 8 + package p 9 + 10 + add: _ @extern("basic.wasm", abi=c, sig="func(int64, int64): int64") 11 + 12 + x0: add(*1 | string, *2 | string) 13 + -- basic.wasm -- 14 + -- out/wasm -- 15 + add: add 16 + x0: 3
+59
cue/testdata/builtins/default.txtar
··· 1 + -- in.cue -- 2 + import ( 3 + "list" 4 + "strings" 5 + "text/template" 6 + ) 7 + 8 + Len: len(*[1, 2, 3] | 0) 9 + Close: close(*{} | 0) 10 + And: and(*[1, 1] | int) 11 + Or: or(*[1, 1] | int) 12 + Div: div(*5 | string, 2) 13 + Mod: mod(*5 | string, 2) 14 + Quo: quo(*5 | string, 2) 15 + Rem: rem(*5 | string, 2) 16 + -- out/compile -- 17 + --- in.cue 18 + { 19 + Len: len((*[ 20 + 1, 21 + 2, 22 + 3, 23 + ]|0)) 24 + Close: close((*{}|0)) 25 + And: and((*[ 26 + 1, 27 + 1, 28 + ]|int)) 29 + Or: or((*[ 30 + 1, 31 + 1, 32 + ]|int)) 33 + Div: div((*5|string), 2) 34 + Mod: mod((*5|string), 2) 35 + Quo: quo((*5|string), 2) 36 + Rem: rem((*5|string), 2) 37 + } 38 + -- out/eval/stats -- 39 + Leaks: 0 40 + Freed: 45 41 + Reused: 40 42 + Allocs: 5 43 + Retain: 0 44 + 45 + Unifications: 25 46 + Conjuncts: 52 47 + Disjuncts: 45 48 + -- out/eval -- 49 + (struct){ 50 + Len: (int){ 3 } 51 + Close: (struct){ 52 + } 53 + And: (int){ 1 } 54 + Or: (int){ 1 } 55 + Div: (int){ 2 } 56 + Mod: (int){ 1 } 57 + Quo: (int){ 2 } 58 + Rem: (int){ 1 } 59 + }
+21
pkg/net/testdata/toip4.txtar
··· 1 + -- in.cue -- 2 + import "net" 3 + 4 + fail: { 5 + t1: net.ToIP4(1 | 2) 6 + t2: net.ToIP4(string) 7 + } 8 + 9 + ok: { 10 + t1: net.ToIP4(*"4.4.4.4" | "8.8.8.8") 11 + } 12 + -- out/net -- 13 + import "net" 14 + 15 + fail: { 16 + t1: net.ToIP4(1 | 2) 17 + t2: net.ToIP4(string) 18 + } 19 + ok: { 20 + t1: [4, 4, 4, 4] 21 + }
+6
pkg/strings/testdata/join.txtar
··· 1 + -- in.cue -- 2 + import "strings" 3 + 4 + disjunctDefault: strings.Join(*["Hello", "World!"] | int, " ") 5 + -- out/strings -- 6 + disjunctDefault: "Hello World!"