2 # Copyright (C) 2010, Parrot Foundation.
11 Test the osutils library
15 % prove t/library/osutils.t
20 .include 'test_more.pir'
22 load_bytecode 'osutils.pir'
33 $S0 = 'foo/bar/baz.txt'
35 is( $S0, 'baz.txt', "basename" )
39 $S0 = 'foo/bar/baz.txt'
41 is( $S0, 'foo/bar', "dirname" )
43 is( $S0, 'foo', "dirname" )
45 is( $S0, '.', "dirname" )
49 $S0 = catfile('abc', 'def', 'ghi')
50 is($S0, 'abc/def/ghi', "catfile")
54 .local string volume, directories, file
55 (volume, directories, file) = splitpath('abc/def/ghi.txt')
56 is(volume, '', "splitpath vol")
57 is(directories, 'abc/def', "splitpath dirs")
58 is(file, 'ghi.txt', "splitpath file")
60 (volume, directories, file) = splitpath('c:/abc/def/ghi.txt')
61 is(volume, 'c:', "splitpath vol")
62 is(directories, '/abc/def', "splitpath dirs")
63 is(file, 'ghi.txt', "splitpath file")
67 $I0 = newer('runtime/parrot/library/osutils.pbc', 'runtime/parrot/library/osutils.pir')
68 ok($I0, "newer('osutils.pbc', 'osutils.pir')")
69 $I0 = newer('runtime/parrot/library/osutils.no_file', 'runtime/parrot/library/osutils.pir')
70 nok($I0, "newer('osutils.no_file', 'osutils.pir')")
71 $I0 = newer('runtime/parrot/library/osutils.pir', 'runtime/parrot/library/osutils.pir')
72 nok($I0, "newer('osutils.pir', 'osutils.pir')")
74 $P0 = split ' ', 'runtime/parrot/library/osutils.pir runtime/parrot/include/stat.pasm'
75 $I0 = newer('runtime/parrot/library/osutils.pbc', $P0)
76 ok($I0, "newer('osutils.pbc', ['osutils.pir', 'stat.pasm'])")
77 $I0 = newer('runtime/parrot/library/osutils.no_file', $P0)
78 nok($I0, "newer('osutils.no_file', ['osutils.pir', 'stat.pasm'])")
79 $I0 = newer('runtime/parrot/library/osutils.pir', $P0)
80 nok($I0, "newer('osutils.pir', ['osutils.pir', 'stat.pasm'])")
88 # vim: expandtab shiftwidth=4 ft=pir: