2 # Copyright (C) 2006-2010, Parrot Foundation.
7 t/library/cgi_query_hash.t - test [ 'CGI'; 'QueryHash' ]
11 % prove t/library/cgi_query_hash.t
15 Test [ 'CGI'; 'QueryHash' ]
20 load_bytecode "dumper.pbc"
21 .include 'test_more.pir'
23 load_bytecode 'CGI/QueryHash.pbc'
31 .local pmc parse_get_sub
32 parse_get_sub = get_global [ 'CGI'; 'QueryHash' ], 'parse_get'
33 is_defined = defined parse_get_sub
34 ok( is_defined, 'got the sub "parse_get"' )
39 ok( my_env, 'Got an .Env pmc' )
40 my_env['REQUEST_TYPE'] = 'GET'
42 my_env['QUERY_STRING'] = 'as=df'
43 query_hash = parse_get_sub()
44 val = query_hash['as']
45 is( val, 'df', 'single GET param' )
47 my_env['QUERY_STRING'] = 'sky=blue;grass=green&water=wet'
48 query_hash = parse_get_sub()
49 val = query_hash['sky']
50 is( val, 'blue', 'first of three GET params' )
51 val = query_hash['grass']
52 is( val, 'green', 'second of three GET params' )
53 val = query_hash['water']
54 is( val, 'wet', 'third of three GET params' )
56 my_env['QUERY_STRING'] = 'a=1'
57 query_hash = parse_get_sub()
59 is( val, '1', 'numeric value' )
65 Bernhard Schmalhofer <Bernhard Schmalhofer@gmx.de>
73 # vim: expandtab shiftwidth=4 ft=pir: