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

     1  doc_meta: |
     2    folder: block-func
     3    title: complicated test case 5
     4    head: |
     5      complicated test case for a combination of:
     6      * dvar, dvar to object, keepName
     7      * loop in block func in a callee func
     8      * taskScope to pass loop item to callee
     9  
    10    sections:
    11      - title: Demo
    12        log: yes
    13  
    14  notes:
    15    - fix toObj and keepName not working in taskScope
    16  
    17  tasks:
    18    -
    19      name: task
    20      task:
    21  
    22        -
    23          func: cmd
    24          dvars:
    25            - name: aaa
    26              value: var_a_from_task
    27              flags:
    28                - taskScope
    29            - name: countries
    30              value: |
    31                - Austraila
    32                - US
    33                - China
    34                - Japan
    35              flags:
    36                - toObj
    37                - keepName
    38                - taskScope
    39                - v
    40  
    41        -
    42          func: cmd
    43          do:
    44            - name: print
    45              cmd: '{{.countries}}'
    46            - name: typeOf
    47              cmd:
    48                - 'countries'
    49  
    50        -
    51          func: call
    52          do:
    53            - sub_task
    54  
    55    -
    56      name: sub_task
    57      task:
    58  
    59        -
    60          func: block
    61          loop: countries
    62          vars:
    63            aaa: var_a_from_sub_task
    64          do:
    65            -
    66              func: cmd
    67              desc: |
    68                inspect if the correct parameter has been passed in correctly
    69                with default value
    70                in block func
    71              do:
    72                - name: assert
    73                  cmd:
    74                    - '{{eq .aaa "var_a_from_task"}}'
    75            -
    76              func: shell
    77              do:
    78                - echo "{{.aaa}}"
    79                - echo "{{.loopitem}}"