# file : tests/variable/target-type-pattern-specific/testscript # license : MIT; see accompanying LICENSE file # NOTE: see also old tests. .include ../../common.testscript : basic : $* <>EOO x = x y = y dir{*}: x = X dir{*}: y += Y ./: print $(./: x) print $(./: y) EOI X y Y EOO : old-tests-type-pattern : $* <>EOO dir{*}: x = y x = z dir{*-foo}: x = $x # 'z' bar-foo/: print $(bar-foo/: x) x = G file{*-foo}: x = x file{xfoo}: x = $x # 'G' print $(file{xfoo}: x) file{-foo}: x = $x # 'x' print $(file{-foo}: x) file{x-foo}: x = $x # 'x' print $(file{x-foo}: x) file{bar-*-foo}: x = X file{bar-x}: x = $x # 'G' print $(file{bar-x}: x) file{bar--foo}: x = $x # 'X' print $(file{bar--foo}: x) file{bar-x-foo}: x = $x # 'X' print $(file{bar-x-foo}: x) file{*-fox}: x = 1 file{fox-*}: x = 2 file{fox-fox}: x = $x # '2' print $(file{fox-fox}: x) file{*-fox}: x = 3 file{fox-x-fox}: x = $x # still '2'! print $(file{fox-fox}: x) *-foz: x = z # any target file{x-foz}: x = $x # 'z' print $(file{x-foz}: x) *: x1 = X1 {*}: x2 = X2 target{*}: x3 = X3 file{x}: print $(file{x}: x1) print $(file{x}: x2) print $(file{x}: x3) EOI z G x x G X X 2 2 z X1 X2 X3 EOO : block : $* <>EOO x = x y = y dir{*}: { x = X y += Y z = $x # Note: from scope. } ./: print $(./: x) print $(./: y) print $(./: z) EOI X y Y x EOO : block-multiple : $* <>EOO x = x y = y file{f*} file{b*}: { x = X y += Y } file{foo bar}: print $(file{foo}: x) print $(file{bar}: y) EOI X y Y EOO : regex : { : flag-icase : $* <>EOO file{~/'.+\.txt'/i}: x = 1 file{foo.txt foo.TXT}: print $(file{foo.txt}: x) print $(file{foo.TXT}: x) EOI 1 1 EOO : flag-match-ext : $* <>EOO define txt: file txt{*}: x = 0 txt{~/'[^.]+'/}: x = 1 txt{~/'.+\.tx'/e}: x = 2 txt{~/'.+\.txt'/e}: x = 3 txt{foo.x foo.tx foo.txt foo.bar...}: print $(txt{foo.x}: x) print $(txt{foo.tx}: x) print $(txt{foo.txt}: x) print $(txt{foo.bar...}: x) EOI 1 2 3 0 EOO : backref : $* <>EOO x = 0 file{~/'(.+)-\1'/}: x = 1 file{foo-foo foo-bar}: print $(file{foo-foo}: x) print $(file{foo-bar}: x) EOI 1 0 EOO : dir : $* <>EOO foo/dir{~/b.+/}: x = 1 foo/dir{bar}: print $(foo/dir{bar}: x) EOI 1 EOO : invalid : $* <>~/EOE/ != 0 file{~/'(.+'/}: x = 1 EOI /:1:1: error: invalid regex pattern .+/ EOE }