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

     1  doc_meta: |
     2    folder: vars
     3    title: taskScope vars in callee
     4    head: |
     5      This is a test case to show that the taskScope var could be passed to callee task and it will override what has been defined in callee if the var name is same
     6  
     7    sections:
     8      - title: Demo
     9        log: yes
    10  
    11  
    12  notes:
    13    goal:
    14      - to test out the task vars dealing in sub task is all correct and expected
    15  
    16  vars:
    17    tom: this is tom
    18  
    19  tasks:
    20    -
    21      name: task
    22      task:
    23        -
    24          func: cmd
    25          dvars:
    26            - name: jerry
    27              value: this is jerry in task scope
    28              flags:
    29                - taskScope
    30          do:
    31            - name: print
    32              desc: this should print out the dvar value of jerry
    33              cmd: '{{.jerry}}'
    34  
    35        -
    36          func: call
    37          do:
    38            - subtask1
    39  
    40    -
    41      name: subtask1
    42      task:
    43        -
    44          func: cmd
    45          do:
    46            - name: print
    47              desc: this should print out the dvar value of jerry as it is declared jerry is in taskScope
    48              cmd: '{{.jerry}}'
    49            - name: trace
    50              cmd: ===>
    51  
    52        -
    53          func: cmd
    54          vars:
    55            jerry: jerry is overriden in local scope
    56          do:
    57            - name: print
    58              desc: |
    59                remember that the caller's vars should override callee's vars
    60                so jerry's value should the one from caller instead this local value
    61              cmd: '{{.jerry}}'
    62            - name: trace
    63              cmd: <===
    64  
    65            - name: trace
    66              cmd: --->
    67  
    68        -
    69          func: cmd
    70          do:
    71            - name: print
    72              desc: this should print out the jerry defined in caller's task var scope
    73              cmd: '{{.jerry}}'
    74            - name: trace
    75              cmd: <---