From 44a919e7f8ba3ed4ac1d684e958a296b5ebec1d0 Mon Sep 17 00:00:00 2001 From: Sam Alba Date: Mon, 31 May 2021 15:56:58 +0200 Subject: [PATCH] test: implemented tests for output list Signed-off-by: Sam Alba --- tests/cli.bats | 32 ++++++++++++++++++++++++++++++++ tests/cli/output/list/main.cue | 19 +++++++++++++++++++ 2 files changed, 51 insertions(+) create mode 100644 tests/cli/output/list/main.cue diff --git a/tests/cli.bats b/tests/cli.bats index e5e0f81f..9b075158 100644 --- a/tests/cli.bats +++ b/tests/cli.bats @@ -320,3 +320,35 @@ setup() { run bash -c "echo \"$outAll\" | grep cfg.strSet | grep string | grep pipo" assert_success } + +@test "dagger output list" { + "$DAGGER" init + + dagger_new_with_plan list "$TESTDIR"/cli/output/list + + run "$DAGGER" output list -e "list" + assert_failure + + "$DAGGER" up -e "list" + + out="$("$DAGGER" output list -e "list")" + outAll="$("$DAGGER" output list --all -e "list")" + + run bash -c "echo \"$out\" | grep cfgInline.url | grep 'http://this.is.a.test/' | grep 'test url description'" + assert_success + + run bash -c "echo \"$out\" | grep cfg.url | grep 'http://this.is.a.test/' | grep 'test url description'" + assert_success + + run bash -c "echo \"$out\" | grep cfg2.url | grep 'http://this.is.a.test/' | grep 'test url description'" + assert_success + + run bash -c "echo \"$out\" | grep cfg.str" + assert_failure + + run bash -c "echo \"$outAll\" | grep cfg.str" + assert_success + + run bash -c "echo \"$outAll\" | grep cfg2.url" + assert_success +} diff --git a/tests/cli/output/list/main.cue b/tests/cli/output/list/main.cue new file mode 100644 index 00000000..9aa65e75 --- /dev/null +++ b/tests/cli/output/list/main.cue @@ -0,0 +1,19 @@ +package main + +#A: { + // a string + str: string @dagger(output) + strSet: "pipo" @dagger(input) + strDef: *"yolo" | string @dagger(input) + + // test url description + url: "http://this.is.a.test/" @dagger(output) + url2: url +} + +cfgInline: { + #A +} + +cfg: #A +cfg2: cfg