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

     1  doc_meta: |
     2    folder: call-func
     3    title: overriden in callee
     4    head: |
     5      This showcases the vars in callee will be overriden if there is a same name var passed from caller. This is a feature of call func
     6  
     7    sections:
     8      - title: Demo
     9        log: yes
    10  
    11  notes:
    12    - to test out that that the caller's var will override callees' local var
    13  
    14  vars:
    15    global_a: aaa
    16    global_b: bbb
    17  
    18  tasks:
    19    -
    20      name: task
    21      task:
    22        -
    23          func: call
    24          vars:
    25            local_a: aaa
    26            local_b: bbb
    27            tom: my name is tom
    28          do:
    29            - subtask1
    30  
    31    -
    32      name: subtask1
    33      task:
    34        -
    35          func: cmd
    36          do:
    37            - name: print
    38              cmd: '{{.tom}}'
    39  
    40            -
    41              name: assert
    42              cmd:
    43                - '{{eq .tom "my name is tom"}}'
    44  
    45        -
    46          func: cmd
    47          vars:
    48            tom: 'hi i am tom'
    49          do:
    50            - name: print
    51              cmd: '{{.tom}}'
    52            -
    53              name: assert
    54              cmd:
    55                - '{{eq .tom "my name is tom"}}'