blob: 5ebcd3a7da3b2f8108c09a75c0c083ddf031a8cc [file] [log] [blame]
-- in.cue --
import "list"
repeat: {
[string]: {x: _, n: int, v: list.Repeat(x, n)}
t1: {x: [], n: 0}
t2: {x: [1], n: 0}
t3: {x: [1], n: 1}
t4: {x: [1, 2], n: 1}
t5: {x: [], n: 3}
t6: {x: [1, 2], n: 3}
t7: {x: [1, 2, 3, 4], n: 3}
t8: {x: [1], n: -1}
}
concat: {
[string]: {x: _, v: list.Concat(x)}
t1: x: []
t2: x: [[]]
t3: x: [[1]]
t4: x: [[1, 2]]
t5: x: [[1], [2]]
t6: x: [[1, 2], [3, 4]]
t7: x: 1
t8: x: [1, [2]]
}
unique: {
issue797: {
mylst: [
{ foo: "bar" },
{ foo: "baz" }
]
_testmylst: list.UniqueItems & [for x in mylst { x.foo } ]
}
}
-- out/list --
Errors:
error in call to list.Repeat: negative count
concat.t7.v: cannot use 1 (type int) as list in argument 1 to list.Concat:
./in.cue:30:12
error in call to list.Concat: cannot use value 1 (type int) as list:
./in.cue:31:13
Result:
repeat: {
t1: {
x: []
n: 0
v: []
}
t2: {
x: [1]
n: 0
v: []
}
t3: {
x: [1]
n: 1
v: [1]
}
t4: {
x: [1, 2]
n: 1
v: [1, 2]
}
t5: {
x: []
n: 3
v: []
}
t6: {
x: [1, 2]
n: 3
v: [1, 2, 1, 2, 1, 2]
}
t7: {
x: [1, 2, 3, 4]
n: 3
v: [1, 2, 3, 4, 1, 2, 3, 4, 1, 2, 3, 4]
}
t8: {
x: [1]
n: -1
v: _|_ // error in call to list.Repeat: negative count (and 1 more errors)
}
}
concat: {
t1: {
x: []
v: []
}
t2: {
x: [[]]
v: []
}
t3: {
x: [[1]]
v: [1]
}
t4: {
x: [[1, 2]]
v: [1, 2]
}
t5: {
x: [[1], [2]]
v: [1, 2]
}
t6: {
x: [[1, 2], [3, 4]]
v: [1, 2, 3, 4]
}
t7: {
x: 1
v: _|_ // concat.t7.v: cannot use 1 (type int) as list in argument 1 to list.Concat
}
t8: {
x: [1, [2]]
v: _|_ // error in call to list.Concat: cannot use value 1 (type int) as list (and 1 more errors)
}
}
unique: {
issue797: {
mylst: [{
foo: "bar"
}, {
foo: "baz"
}]
}
}