cuelang.org/go@v0.10.1/tools/flow/testdata/issue2416b.txtar (about)

     1  #IgnoreConcrete: true
     2  #InferTasks: true
     3  -- in.cue --
     4  import (
     5  	"strings"
     6  	"tool/cli"
     7  )
     8  
     9  #Input: INPUT={
    10  	kind: string
    11  	outKey: string | *"default"
    12  	if kind != "foo" {
    13  		outKey: INPUT.kind
    14  	}
    15  }
    16  inputs: f: #Input & { kind: "foo" }
    17  inputs: b: #Input & { kind: "bar" }
    18  
    19  outputs: [string]: string
    20  for _, input in inputs {
    21  	outputs: "\(input.outKey)": input.kind
    22  }
    23  
    24  root: print: cli.Print & {
    25  	text: strings.Join([for key, val in outputs { "key=\(key) val=\(val)" }], "\n")
    26  }
    27  -- out/run/errors --
    28  -- out/run/t0 --
    29  graph TD
    30    t0("root.print [Ready]")
    31  
    32  -- out/run/t1 --
    33  graph TD
    34    t0("root.print [Terminated]")
    35  
    36  -- out/run/t1/value --
    37  {
    38  	$id:    "tool/cli.Print"
    39  	stdout: "foo"
    40  	text: """
    41  		key=default val=foo
    42  		key=bar val=bar
    43  		"""
    44  }
    45  -- out/run/t1/stats --
    46  Leaks:  0
    47  Freed:  30
    48  Reused: 24
    49  Allocs: 6
    50  Retain: 1
    51  
    52  Unifications: 22
    53  Conjuncts:    56
    54  Disjuncts:    31
    55  -- out/run/stats/totals --
    56  Leaks:  0
    57  Freed:  30
    58  Reused: 24
    59  Allocs: 6
    60  Retain: 1
    61  
    62  Unifications: 22
    63  Conjuncts:    56
    64  Disjuncts:    31