2 # Copyright (C) 2008-2010, Parrot Foundation.
15 % prove t/library/tcl_glob.t
20 load_bytecode 'Test/More.pbc'
22 .local pmc exports, curr_namespace, test_namespace
23 curr_namespace = get_namespace
24 test_namespace = get_namespace ['Test';'More']
25 exports = split ' ', 'plan diag ok nok is isa_ok'
27 test_namespace.'export_to'(curr_namespace, exports)
32 # make sure we can load the library
34 load_bytecode 'Tcl/Glob.pbc'
36 ok(1, 'load_bytecode')
38 is_glob( 'asdf', 'asdf', 'exact match +')
39 isnt_glob('asdf', 'asd', 'exact match -')
41 is_glob('asdf', '*', '* entire')
42 is_glob('asdf', 'a*', '* trailing +')
43 is_glob('asdf', '*f', '* leading +')
44 is_glob('asdf', 'a*f', '* mid +')
45 is_glob('asdf', '*asdf', 'null match')
47 isnt_glob('asdf', 'f*', '* trailing -')
48 isnt_glob('asdf', '*a', '* leading -')
49 isnt_glob('asdf', 'a*a', '* mid +-')
50 isnt_glob('asdf', 'f*f', '* mid -+')
51 isnt_glob('asdf', 'f*a', '* mid --')
53 is_glob('asdf', '????', '? all')
54 is_glob('asdf', 'as?f', '? single')
56 isnt_glob('asdf', 'asdf?', '? -')
58 is_glob('asdf', 'asd[asdf]', '[]')
59 is_glob('as_f', 'as[A-z]f', '[] ascii order +')
61 isnt_glob('as_f', 'as[a-z]f', '[] ascii order -')
63 is_glob('?', '\?', '\?')
64 is_glob('*', '\*', '\*')
65 is_glob('[', '\[', '\[')
66 is_glob(']', '\]', '\]')
67 is_glob('\\', '\\\\', '\\\\')
72 .param string original
74 .param string test_description
77 boolean = do_glob(original,glob)
78 is(1, boolean, test_description)
82 .param string original
84 .param string test_description
87 boolean = do_glob(original,glob)
88 is(0, boolean, test_description)
92 .param string original
96 globber = compreg 'Tcl::Glob'
99 rule = globber.'compile'(glob)
102 result = rule(original)
105 boolean = istrue result
114 # vim: expandtab shiftwidth=4 ft=pir: