Skip to content

Commit

Permalink
cmd/cue: add test cases for embedding files inside symlink dirs
Browse files Browse the repository at this point in the history
This is different than embedding a symlink itself, as we follow
a symlink as part of traversing a directory to open a regular file
or match a glob resulting in regular files.

For #3299.

Signed-off-by: Daniel Martí <[email protected]>
Change-Id: I1c02a64a442b2a1c29192a29171b0ad6a903b43e
Reviewed-on: https://review.gerrithub.io/c/cue-lang/cue/+/1199041
Reviewed-by: Roger Peppe <[email protected]>
TryBot-Result: CUEcueckoo <[email protected]>
Unity-Result: CUE porcuepine <[email protected]>
  • Loading branch information
mvdan committed Aug 7, 2024
1 parent 4d941df commit 677ece8
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions cmd/cue/cmd/testdata/script/embed_err.txtar
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ cmp stderr out/err
cd symlink
symlink symlink.json -> test.json
symlink symlink-parent.json -> ../test.json
symlink symlink-dir -> y
exec cue eval .
cmp stdout out/std

Expand Down Expand Up @@ -177,8 +178,14 @@ package symlink
file: _ @embed(file=symlink.json)

glob: _ @embed(glob="*.json")

fileSymlinkDir: _ @embed(file=symlink-dir/test.json)

globSymlinkDir: _ @embed(glob="symlink-dir/*.json")
-- symlink/test.json --
{ "x": "symlink target file" }
-- symlink/y/test.json --
{ "y": "another symlink target file" }
-- symlink/out/std --
file: {
x: "symlink target file"
Expand All @@ -194,3 +201,11 @@ glob: {
x: "symlink target file"
}
}
fileSymlinkDir: {
y: "another symlink target file"
}
globSymlinkDir: {
"symlink-dir/test.json": {
y: "another symlink target file"
}
}

0 comments on commit 677ece8

Please sign in to comment.