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

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