forked from rosa/hakurei
internal/rosa/azalea: refactor delimiter insertion, add test
This commit is contained in:
@@ -64,7 +64,22 @@ func TestParse(t *testing.T) {
|
||||
{"missing array delimiter", `[ v0 v1 ]`, nil, TokenError{',', scanner.Ident}},
|
||||
{"truncated array", `[ "\x00"`, nil,
|
||||
ExprError(scanner.EOF)},
|
||||
|
||||
{"array of func", "[\nf {\n v = v\n v2 =\n v2\n }\n g {\n w = w\n w2 = w2\n}\n]\n", []any{Array{
|
||||
Val{Func{
|
||||
Ident: Ident("f"),
|
||||
Args: []Arg{
|
||||
{K: []Ident{Ident("v")}, V: Val{Ident("v")}},
|
||||
{K: []Ident{Ident("v2")}, V: Val{Ident("v2")}},
|
||||
},
|
||||
}},
|
||||
Val{Func{
|
||||
Ident: Ident("g"),
|
||||
Args: []Arg{
|
||||
{K: []Ident{Ident("w")}, V: Val{Ident("w")}},
|
||||
{K: []Ident{Ident("w2")}, V: Val{Ident("w2")}},
|
||||
},
|
||||
}},
|
||||
}}, nil},
|
||||
{"gcc", gccSample, []any{Func{
|
||||
Ident: Ident("gcc"),
|
||||
Package: true,
|
||||
@@ -153,8 +168,7 @@ func TestParse(t *testing.T) {
|
||||
{K: []Ident{Ident("version")}, V: Val{String("26.2.0")}, R: true},
|
||||
|
||||
{K: []Ident{Ident("source")}, V: Val{Func{
|
||||
Ident: Ident("remoteGitLab"),
|
||||
Package: false,
|
||||
Ident: Ident("remoteGitLab"),
|
||||
Args: []Arg{
|
||||
{K: []Ident{Ident("domain")}, V: Val{String("gitlab.freedesktop.org")}},
|
||||
{K: []Ident{Ident("suffix")}, V: Val{String("mesa/mesa")}},
|
||||
@@ -162,7 +176,7 @@ func TestParse(t *testing.T) {
|
||||
{K: []Ident{Ident("checksum")}, V: Val{String("UPnIdpo5wUsE938GXY-YyYDzfF62enRoEzCYRyLLPvzBhBbP4wZ8nDiKsjivcs5v")}},
|
||||
},
|
||||
}}},
|
||||
{K: []Ident{Ident("exec")}, V: Val{Func{Ident: Ident("meson"), Package: false, Args: []Arg{
|
||||
{K: []Ident{Ident("exec")}, V: Val{Func{Ident: Ident("meson"), Args: []Arg{
|
||||
{K: []Ident{Ident("setup")}, V: Val{[]KV{
|
||||
{K: String("platforms"), V: Val{String("x11,wayland")}},
|
||||
{K: String("video-codecs"), V: Val{String("all")}},
|
||||
@@ -170,8 +184,7 @@ func TestParse(t *testing.T) {
|
||||
{K: String("gbm"), V: Val{String("enabled")}},
|
||||
{K: String("egl"), V: Val{String("enabled")}},
|
||||
{K: String("gallium-drivers"), V: Val{Func{
|
||||
Ident: Ident("join"),
|
||||
Package: false,
|
||||
Ident: Ident("join"),
|
||||
Args: []Arg{
|
||||
{K: []Ident{Ident("elems")}, V: Val{Array{
|
||||
Val{String("asahi")},
|
||||
@@ -198,8 +211,7 @@ func TestParse(t *testing.T) {
|
||||
},
|
||||
}}},
|
||||
{K: String("vulkan-drivers"), V: Val{Func{
|
||||
Ident: Ident("join"),
|
||||
Package: false,
|
||||
Ident: Ident("join"),
|
||||
Args: []Arg{
|
||||
{K: []Ident{Ident("elems")}, V: Val{Array{
|
||||
Val{String("amd")},
|
||||
@@ -217,8 +229,7 @@ func TestParse(t *testing.T) {
|
||||
{K: []Ident{Ident("sep")}, V: Val{String(",")}}},
|
||||
}}},
|
||||
{K: String("vulkan-layers"), V: Val{Func{
|
||||
Ident: Ident("join"),
|
||||
Package: false,
|
||||
Ident: Ident("join"),
|
||||
Args: []Arg{
|
||||
{K: []Ident{Ident("elems")}, V: Val{Array{
|
||||
Val{String("device-select")},
|
||||
|
||||
Reference in New Issue
Block a user