github.com/upcmd/up@v0.8.1-0.20230108151705-ad8b797bf04f/tests/functests/f0077.yml (about)

     1  docs:
     2    mddoc: |
     3      this is to show validation error:
     4      var validation [multiple expand > 1 is not allowed when toObj is set]
     5  
     6  vars:
     7    complex_data_structure_template: |
     8      school:
     9        name: '{{.school_name}}'
    10        address: '{{.school_address}}'
    11      principals:
    12      {{- range $_, $p :=.schoo_principals }}
    13        - {{$p}}
    14      {{- end}}
    15      ranking: '{{.schoo_ranking}}'
    16  
    17  tasks:
    18        -
    19          func: cmd
    20          desc: |
    21            this is to show validation error:
    22            var validation [multiple expand > 1 is not allowed when toObj is set]
    23          vars:
    24            school_name: sydney grammar
    25            school_address: 1 fox road, sydney, nsw 2000
    26            schoo_principals:
    27              - peter
    28              - tom
    29              - jane
    30            schoo_ranking: No 5
    31          dvars:
    32            - name: school_yml
    33              desc: use dynamic expand == 2, so that the template will be rendered
    34              value: '{{.complex_data_structure_template}}'
    35              expand: 2
    36              flags: [vvvv,toObj, ignoreError]
    37          do:
    38            - name: print
    39              cmd: '{{.school_yml}}'
    40            - name: print
    41              cmd: '{{.school_yml_object}}'
    42