1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
|
# file : tests/function/name/testscript
# license : MIT; see accompanying LICENSE file
.include ../../common.testscript
: is_a
:
{
$* <'print $is_a(file{foo}, path_target)' >'true' : basics-true
$* <'print $is_a(alias{foo}, path_target)' >'false' : basics-false
$* <'print $is_a(file{foo}@./, path_target)' >'true' : out
$* <<EOI >'true' : derived
define txt: file
print $is_a(txt{foo}, path_target)
EOI
}
: filter
:
{
$* <<EOI >'file{foo}@./ txt{baz}' : basics
define txt: file
print $filter(file{foo}@./ alias{bar} dir{./} txt{baz}, file)
EOI
$* <<EOI >'file{foo}@./ txt{baz}' : basics-out
define txt: file
print $filter_out(file{foo}@./ alias{bar} dir{./} txt{baz}, alias)
EOI
$* <<EOI >'file{foo}@./ dir{./} txt{baz}' : multiple
define txt: file
print $filter(file{foo}@./ alias{bar} dir{./} txt{baz}, file dir)
EOI
$* <<EOI >'file{foo}@./ alias{bar}' : multiple-out
define txt: file
print $filter_out(file{foo}@./ alias{bar} dir{./} txt{baz}, txt dir)
EOI
}
: size
:
{
$* <'print $size(a b c@./)' >'3' : basics
$* <'print $type($size(a))' >'uint64' : type
}
: sort
:
{
$* <'print $sort(d/t{a} t{c b} d/t{a})' >'t{b} t{c} d/t{a} d/t{a}' : basics
$* <'print $sort(d/t{a} t{c b} d/t{a}, dedup)' >'t{b} t{c} d/t{a}' : dedup
}
: find
:
{
$* <'print $find([names] d/t{a} t{a b}, t{a})' >'true' : basics-true
$* <'print $find([names] d/t{a} t{a b}, d/t{b})' >'false' : basics-false
}
: find_index
:
{
$* <'print $find_index([names] d/t{a} t{a b}, t{a})' >'1' : basics-true
$* <'print $find_index([names] d/t{a} t{a b}, d/t{b})' >'3' : basics-false
}
|