pike.git/
src/
testsuite.in
Branch:
Tag:
Non-build tags
All tags
No tags
2001-05-17
2001-05-17 16:58:39 by Henrik Grubbström (Grubba) <grubba@grubba.org>
70b9204667fc956976042d5eab4d3e86e34ffe18 (
61
lines) (+
51
/-
10
)
[
Show
|
Annotate
]
Branch:
7.9
Added tests for String.SplitIterator.
Rev: src/testsuite.in:1.410
1:
-
test_true([["$Id: testsuite.in,v 1.
409
2001/05/
15
20
:
49
:
09
mirar
Exp $"]]);
+
test_true([["$Id: testsuite.in,v 1.
410
2001/05/
17
16
:
58
:
39
grubba
Exp $"]]);
cond([[all_constants()->_verify_internals]], [[
4839:
return ret; ]],315)
+
// String.SplitIterator
+
test_any([[
+
object it = String.SplitIterator(" foobar gazonk gurka baz ", ' ');
+
array res = ({});
+
foreach(it; int i; string part) {
+
res += ({ it });
+
}
+
return equal(res, " foobar gazonk gurka baz "/" ");
+
]], 1)
+
test_any([[
+
object it = String.SplitIterator(" foobar gazonk gurka baz ", ' ');
+
return sizeof(it);
+
]], [[
+
return sizeof(" foobar gazonk gurka baz "/" ");
+
]])
+
test_any([[
+
object it = String.SplitIterator(" foobar gazonk gurka baz ", ' ', 1);
+
array res = ({});
+
foreach(it; int i; string part) {
+
res += ({ it });
+
}
+
return equal(res, "foobar gazonk gurka baz"/" ");
+
]], 1)
+
test_any([[
+
object it = String.SplitIterator(" foobar gazonk gurka baz ", ' ');
+
return sizeof(it);
+
]], [[
+
return sizeof("foobar gazonk gurka baz"/" ");
+
]])
-
+
// do-while test_any(int e;string t=""; e=0; do{ t+=e; }while(++e<6); return t,"012345";)
7175:
test_program([[ int ok=1;
+
void test_resolv(string file, int base_size)
+
{
+
string prg = replace( file[base_size+1..sizeof(file)-6],
+
([ "/":".", ".pmod":""]) );
+
if(prg[sizeof(prg)-7..]==".module")
+
prg = prg[..sizeof(prg)-8];
+
werror("Resolving %O...\n", prg);
+
if( catch( master()->resolv(prg) ) ) {
+
werror("test: failed to peek at %O\n", prg);
+
ok=0;
+
}
+
}
+
void test_dir(string dir, int|void base_size) {
-
//
werror("Testing directory %O...\n", dir);
+
werror("Testing directory %O...\n", dir);
if(!base_size) base_size=sizeof(dir); foreach(get_dir(dir), string s) {
7202:
if(!stat) continue; if(stat[1]==-2) {
+
if (glob("*.pmod", file)) {
+
test_resolv(file, base_size);
+
}
test_dir(file, base_size); }else if(stat[1]>=0){
-
//
werror("Testing file %O\n", file);
+
werror("Testing file %O\n", file);
if(!glob("*/my_struct.pmod",file)) { if(glob("*.pike",file) || glob("*.pmod",file))
7216:
ok=0; continue; }
-
string prg = replace( file[base
_
size+1..sizeof
(file
)-6]
,
([ "/":".", ".pmod":""]
)
)
;
-
if(prg[sizeof(prg)-7..]==".module")
-
prg = prg[..sizeof(prg)-8];
-
if( catch( master()->resolv(prg) ) ) {
-
werror("test: failed to compile and peek at %O\n", prg);
-
ok=0;
+
test
_
resolv
(file,
base_size
);
} } } } }
-
}
+
int a() { Array.map(master()->pike_module_path,test_dir);