From: Michael Stapelberg Date: Sat, 10 Sep 2011 22:52:39 +0000 (+0100) Subject: extend t/19-match to also test regular expressions X-Git-Tag: 4.1~167^2~5 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=8e04867e5116d2fd95b82cc7101872b1c96ed7d2;p=i3%2Fi3 extend t/19-match to also test regular expressions --- diff --git a/testcases/t/19-match.t b/testcases/t/19-match.t index 2332bc71..4d38c41f 100644 --- a/testcases/t/19-match.t +++ b/testcases/t/19-match.t @@ -34,9 +34,10 @@ my $win = $content->[0]; # first test that matches which should not match this window really do # not match it ###################################################################### -# TODO: use PCRE expressions # TODO: specify more match types -cmd q|[class="*"] kill|; +# we can match on any (non-empty) class here since that window does not have +# WM_CLASS set +cmd q|[class=".*"] kill|; cmd q|[con_id="99999"] kill|; $content = get_ws_content($tmp); @@ -118,4 +119,34 @@ sleep 0.25; $content = get_ws_content($tmp); is(@{$content}, 1, 'one window still there'); +###################################################################### +# check that regular expressions work +###################################################################### + +$tmp = fresh_workspace; + +$left = $x->root->create_child( + class => WINDOW_CLASS_INPUT_OUTPUT, + rect => [ 0, 0, 30, 30 ], + background_color => '#0000ff', +); + +$left->_create; +set_wm_class($left->id, 'special7', 'special7'); +$left->name('left'); +$left->map; +sleep 0.25; + +# two windows should be here +$content = get_ws_content($tmp); +ok(@{$content} == 1, 'two windows opened'); + +cmd '[class="^special[0-9]$"] kill'; + +sleep 0.25; + +$content = get_ws_content($tmp); +is(@{$content}, 0, 'window killed'); + + done_testing;