Используйте foreach или regex для проверки в Eclipse RCPTT - PullRequest
0 голосов
/ 09 мая 2018

После записи в RCPTT у меня есть следующий скрипт:

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

markers['31'][0].Type имеет значение от markers['0'][0].Type - markers['45'][0].Type и числа являются динамическими.

Я хочу проверить, содержит ли маркер любого типа конкретное значение или нет.

Но я не могу с помощью .* или foreach.

Как я могу решить эту проблему?

1 Ответ

0 голосов
/ 10 мая 2018
// 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
        }
    }
}
...