1
2
3
4
5
6
7
8
|
set file "//xvfs:/example/foo"
set fd [open $file]
seek $fd 0 end
seek $fd -1 current
set check [read $fd 1]
if {$check != "\n"} {
error "EXPECTED: (new line); GOT: [binary encode hex $check]"
|
|
>
>
|
1
2
3
4
5
6
7
8
9
10
|
set dir "//xvfs:/example"
set dirNative [file join [pwd] example]
set file "${dir}/foo"
set fd [open $file]
seek $fd 0 end
seek $fd -1 current
set check [read $fd 1]
if {$check != "\n"} {
error "EXPECTED: (new line); GOT: [binary encode hex $check]"
|
44
45
46
47
48
49
50
51
|
}
if {[lsort -integer $output] != $output} {
error "EXPECTED [lsort -integer $output], GOT $output"
}
close $fd
update idle
puts "ALL TESTS PASSED"
|
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
|
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
|
}
if {[lsort -integer $output] != $output} {
error "EXPECTED [lsort -integer $output], GOT $output"
}
close $fd
update idle
proc glob_verify {args} {
set rv [glob -nocomplain -directory $::dir {*}$args]
set verify [glob -nocomplain -directory $::dirNative {*}$args]
if {[llength $rv] != [llength $verify]} {
error "VERIFY FAILED: glob ... $args ($rv versus $verify)"
}
return $rv
}
set check [glob_verify *]
if {[llength $check] < 2} {
error "EXPECTED >=2, GOT [llength $check] ($check)"
}
set check [glob_verify f*]
if {[llength $check] != 1} {
error "EXPECTED 1, GOT [llength $check] ($check)"
}
set check [glob_verify ./f*]
if {[llength $check] != 1} {
error "EXPECTED 1, GOT [llength $check] ($check)"
}
set check [glob_verify -type f ./f*]
if {[llength $check] != 1} {
error "EXPECTED 1, GOT [llength $check] ($check)"
}
set check [glob_verify -type d ./f*]
if {[llength $check] != 0} {
error "EXPECTED 0, GOT [llength $check] ($check)"
}
set check [glob_verify x*]
if {[llength $check] != 0} {
error "EXPECTED 0, GOT [llength $check] ($check)"
}
set check [glob_verify lib/*]
if {[llength $check] != 1} {
error "EXPECTED 1, GOT [llength $check] ($check)"
}
set check [lindex $check 0]
if {![string match $dir/* $check]} {
error "EXPECTED \"$dir/*\", GOT $check"
}
set check [glob_verify -type d *]
if {[llength $check] != 1} {
error "EXPECTED 1, GOT [llength $check] ($check)"
}
puts "ALL TESTS PASSED"
|