Use foreach or regex to verify in Eclipse RCPTT

499 Views Asked by At

After recording in RCPTT, I have the following script:

get-editor "test.c" | get-text-viewer | get-property "markers['31'][0].Type" 
| equals "text-to-verify" | verify-true

markers['31'][0].Type has value from markers['0'][0].Type - markers['45'][0].Type and the numbers are dynamic.

I want to check that any of marker type contain the specific value or not.

But I can't by using .* or foreach.

How can I solve this problem?

1

There are 1 best solutions below

2
On
// This will store the comma separated list
global [val indices 0]
// Set to expected size of indices (10)
global [val list_size [int 10]]

loop [val index [int 1]] {
    global [val indices [concat $indices "," $index]] -override
    if [$index | lt $list_size] {
        recur [$index | plus 1]
    }
}

$indices | split -sep "," | foreach [val item] {
    with [get-editor "test.c" | get-text-viewer] {
        try {
            get-property [concat "markers['" $item "'][0].Type"]
             | equals "text-to-verify" | verify-true
        }
        -catch {
            // You will need to fine-tune this catch to not allow every sort of problems
        }
    }
}