this repo has no description
0
fork

Configure Feed

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

cmd/cue: add first `exp writefs` testscript

We hadn't added one initially because the code was imported from
the cuelang.org repository and we were in a bit of a rush
to make it available for an end user facing slowness.

Now that we can spare a bit of time, and we're going to tweak the code
further and add features, it's time to start testing it.
Especially since our own use in CI is rather basic,
so it doesn't cover e.g. symlinks or non-YAML encodings.

Signed-off-by: Daniel Martí <mvdan@mvdan.cc>
Change-Id: I51e113c7100ef6585260a562f2c8dd7a1ae643c8
Reviewed-on: https://cue.gerrithub.io/c/cue-lang/cue/+/1232052
TryBot-Result: CUEcueckoo <cueckoo@cuelang.org>
Unity-Result: CUE porcuepine <cue.porcuepine@gmail.com>
Reviewed-by: Paul Jolly <paul@myitcv.io>

+64
+64
cmd/cue/cmd/testdata/script/exp_writefs.txtar
··· 1 + # Test the various features of "cue exp writefs" via "cue cmd". 2 + 3 + exists out/to-remove.json 4 + exists out/do-not-remove.md 5 + 6 + [!symlink] skip 'symlinks not supported' 7 + 8 + exec cue cmd gen 9 + cmp out/foo.yaml expect-yaml 10 + cmp out/foo.json expect-json 11 + cmp out/foo.toml expect-toml 12 + cmp out/foo.txt expect-txt 13 + cmp out/foo-noext expect-txt 14 + cmp out/link.yaml expect-yaml 15 + cmp out/sub/dir/foo.yaml expect-nested-yaml 16 + 17 + ! exists out/to-remove.json 18 + exists out/do-not-remove.md 19 + 20 + -- out/to-remove.json -- 21 + -- out/do-not-remove.md -- 22 + -- gen_tool.cue -- 23 + package p 24 + 25 + import ( 26 + "encoding/json" 27 + "tool/exec" 28 + ) 29 + 30 + command: gen: exec.Run & { 31 + cmd: ["cue", "exp", "writefs"] 32 + stdin: json.Marshal({ 33 + tool: "cue cmd gen" 34 + remove: ["out/*.json"] 35 + create: { 36 + "out/foo.yaml": {contents: foo: "as yaml"} 37 + "out/foo.json": {contents: foo: "as json"} 38 + "out/foo.toml": {contents: foo: "as toml"} 39 + "out/foo.txt": {contents: "plain text\n"} 40 + "out/foo-noext": {contents: "plain text\n"} 41 + "out/link.yaml": {type: "symlink", contents: "foo.yaml"} 42 + "out/sub/dir/foo.yaml": {type: "file", contents: foo: "in nested dir"} 43 + } 44 + }) 45 + } 46 + 47 + -- expect-yaml -- 48 + # Code generated cue cmd gen; DO NOT EDIT. 49 + 50 + foo: as yaml 51 + -- expect-json -- 52 + { 53 + "foo": "as json" 54 + } 55 + -- expect-toml -- 56 + # Code generated cue cmd gen; DO NOT EDIT. 57 + 58 + foo = 'as toml' 59 + -- expect-txt -- 60 + plain text 61 + -- expect-nested-yaml -- 62 + # Code generated cue cmd gen; DO NOT EDIT. 63 + 64 + foo: in nested dir