pike.git
/
src
/
testsuite.in
version
»
Context lines:
10
20
40
80
file
none
3
pike.git/src/testsuite.in:942:
test_any([[ class Foo { constant zero = 0; mapping(string:array(int)) m; string foo() { return sprintf("%O", typeof(m[""][zero])); } }; return Foo()->foo(); ]], "int") test_compile_any([[
-
class { ; }
+
class
Foo
{ ; }
]]) test_compile_any([[
-
class { ; ; }
+
class
Foo
{ ; ; }
]]) test_compile_any([[
-
class { ; constant c = 0; }
+
class
Foo
{ ; constant c = 0; }
]]) test_compile_any([[
-
class { mixed a() { constant c = 17; return c; }
+
class
Foo
{ mixed a() { constant c = 17; return c; }
mixed b() { constant c = 17; return c; } } ]]) test_compile_any([[ constant FOO = 0; mapping(int:string) foo = ([FOO: "foo"]); ]]) test_compile_error([[ function(...:int) foo;
pike.git/src/testsuite.in:990:
foreach (indices (args), string a) werror ("%O\n", a); } ]]) // For some reason, the test above doesn't generate the warning (about // the type from indices (args)) if it comes after the one below. // Also, if it is repeated it doesn't generate the warning the second // time. Not very reassuring.. /mast
-
test_any([[return class
Z
{
+
test_any([[return class {
string bonk() { return "oiff"; } class A { string bonk_me() { return bonk(); } } class B { inherit A; } class C
pike.git/src/testsuite.in:2147:
else { function s = lambda () {return x;}; iter = 2; a (1); // F_RECUR_AND_POP return iter; } } ]]); test_do(add_constant("f"))
-
test_false([[object_variablep(class
X
{ int y; int z() { return 1; }}(),"foo")]])
-
test_false([[object_variablep(class
X
{ int y; int z() { return 1; }}(),"z")]])
-
test_true([[object_variablep(class
X
{ int y; int z() { return 1; }}(),"y")]])
+
test_false([[object_variablep(class { int y; int z() { return 1; }}(),"foo")]])
+
test_false([[object_variablep(class { int y; int z() { return 1; }}(),"z")]])
+
test_true([[object_variablep(class { int y; int z() { return 1; }}(),"y")]])
test_any([[ int a,b; [a,b]=({1,2}); return a]],1) test_any([[ int a,b; [a,b]=({1,2}); return b]],2) test_any([[ int a,b; [ [a],b]=({ ({ 1 }) ,2}); return a]],1) test_any([[ int a,b; [ [a],b]=({ ({ 1 }) ,2}); return b]],2) test_any([[ int a; catch { [a]=({1,2}); return 0; }; return 1]],1) test_compile_error([[ int a,b; catch { [a,b]=({1}); return 0; }; return 1]],1) test_any([[ int a,b; catch { [a,b]=lambda(){ return ({1}); }(); return 0; }; return 1]],1) test_any([[ mapping m=([]); m[m]=m; return stringp(sprintf("%O",m)); ]],1) dnl test_any([[
pike.git/src/testsuite.in:4477:
protected class gazonk { void create() { f(); }}; protected class g { object e() { return gazonk(); }}; void create() { g()->e(); }}; return objectp(X()); ]],1) test_any([[class A { int x=1; }; class B { protected inherit A; int foo() { return A::x; }}; return A()->x && !B()->x && B()->foo()==A()->x;]],1) test_any([[class C { int q() { return p(); } int p() { return 17; }}; return C()->q();]],17) test_any([[class C1 { class D { string id() { return "foo"; } }; class Y { program YinD() { return D; }} }; class C2 { inherit C1; class D { string id() { return "bar"; } } }; return C2()->Y()->YinD()()->id()]],"bar")
-
test_any([[object o=class
foo{int
c;class bar{void create(){c++;};}}(); o->bar(); return o->c;]],1)
+
test_any([[object o=class
{int
c;class bar{void create(){c++;};}}(); o->bar(); return o->c;]],1)
test_do([[add_constant("GURKA2",class foo { int c; class bar{void create() {c+=17;}}}()); ]]) test_any([[class x { inherit GURKA2.bar; }(); return GURKA2->c;]],17) test_any([[class x { inherit GURKA2.bar; }(); return GURKA2->c;]],34) test_do([[add_constant("GURKA2",class foo { int c; class bar{void create() { class sune { void create() {c+=17;}}(); }}}()); ]])
-
test_any([[class
x
{ inherit GURKA2.bar; }(); return GURKA2->c;]],17)
-
test_any([[class
x
{ inherit GURKA2.bar; }(); return GURKA2->c;]],34)
+
test_any([[class { inherit GURKA2.bar; }(); return GURKA2->c;]],17)
+
test_any([[class { inherit GURKA2.bar; }(); return GURKA2->c;]],34)
test_do([[add_constant("GURKA2");]]); test_eq(class { protected int foo=17; }()->foo,0) test_eval_error(class c { protected int foo=17; }()->foo=18;) test_equal( [[ ({ (["foo":"bar"]), (<"foo">), ([]) })->foo ]], [[ ({"bar",1,0}) ]]) test_any([[mixed a=({([]),0}); a[1]=a; return a->foo[0];]],0) test_eval_error([[return column(({0}),"foo");]]) test_equal([[ ({ })->foo ]], ({ })) test_equal([[ `->(({ }), "foo") ]], ({ }))
pike.git/src/testsuite.in:4683:
{ string foo = "foo", bar = "bar"; my_lambda = lambda() { return foo; }; } int really_magic_var; return my_lambda(); really_magic_var; ]],"foo")
-
test_eq([[class
c
{ int `()(){ return 4711; } }()(); ]],4711)
+
test_eq([[class { int `()(){ return 4711; } }()(); ]],4711)
teste_eval_error(mixed foo=({}); sort(@foo); ) test_compile_error([[int foo() { return 1} ; constant foo=(["foo":foo]); return foo->foo();]]) test_compile_error([[class T{void p(object e,object f){lambda::create(f);}}]]) test_eval_error(array foo=({}); return mkmapping(foo,({1})); ) test_compile_error([[mapping (string:array(string:string)) foo=([]); ]]) test_compile_error([[int a() { switch(random(2)) { case 3: if(random(2)) { case 0: return 1; } else { case 1: return 2; } } }]]) test_true(encode_value(0)[0]=='\266') define(test_encode, [[ test_equal($1, decode_value(encode_value($1))) test_equal($1, decode_value(encode_value_canonic($1))) ]])
pike.git/src/testsuite.in:4861:
test_any([[mapping m=([0:2]); --m[0]; return --m[0];]], 0); test_any_equal([[ // Test that the type fields are cleared when the mapping is cleared. mapping m = (["a":"a"]); m_delete(m, "a"); return m; ]], ([])) test_compile_error(int foo() { LJjjjjJJJ ; })
-
test_true(class
c
{ constant i=1; }()->i)
-
test_true(class
c
{ constant i=0; mixed `->(string s) { if(s=="i") return 1; }}()->i)
-
test_true(class
c
{ constant i=1; mixed `->(string s) { return 0; }}()["i"])
-
test_true(class
c
{ constant i=0; mixed `[](string s) { if(s=="i") return 1; }}()["i"])
-
test_true(class
c
{ optional constant i=0; mixed `[](string s) { if(s=="i") return 1; }}()["i"])
-
test_true(class
c
{ mixed `[]=(mixed a, mixed b) { if(a!=b) throw(1); }}()[1]=1)
-
test_true(class
c
{ mixed `->=(mixed a, mixed b) { if(a!=b) throw(1); }}()->i="i")
+
test_true(class { constant i=1; }()->i)
+
test_true(class { constant i=0; mixed `->(string s) { if(s=="i") return 1; }}()->i)
+
test_true(class { constant i=1; mixed `->(string s) { return 0; }}()["i"])
+
test_true(class { constant i=0; mixed `[](string s) { if(s=="i") return 1; }}()["i"])
+
test_true(class { optional constant i=0; mixed `[](string s) { if(s=="i") return 1; }}()["i"])
+
test_true(class { mixed `[]=(mixed a, mixed b) { if(a!=b) throw(1); }}()[1]=1)
+
test_true(class { mixed `->=(mixed a, mixed b) { if(a!=b) throw(1); }}()->i="i")
test_do([[ #pragma strict_types class A { int a; optional int x; }; class B { int a; }; A a = B(); return a; ]]) test_compile_error_any([[
pike.git/src/testsuite.in:5250:
int foo() { return q; }; return function_name(foo); ]], "foo") test_any([[ int q; return function_object( lambda() { return q; }); ]],[[this]])
-
test_compile(
class
c
{ object(Stdio.File) foo=
class
foobar
{}
();})
-
test_compile(class
c
{ object(Stdio.File) foo=class {} ();})
-
test_compile_error(class
c
{ object(Stdio.File) foo=class {float is_file;} ();})
-
test_compile(class
c
{ object(Stdio.File) foo=class { int is_file;} ();})
-
test_do(class
c
{ object foo; object(Stdio.File) bar=foo; })
-
test_do(class
c
{ object foo; Stdio.File bar=foo; })
-
test_do(class
c
{ object(Stdio.File) foo; object bar=foo; })
-
test_do(class
c
{ Stdio.File foo; object bar=foo; })
+
test_compile(
[[
+
class {
+
class foobar {} ();
+
object(Stdio.File) foo
= foobar();
+
}
]]
)
+
test_compile(class { object(Stdio.File) foo=class {} ();})
+
test_compile_error(class { object(Stdio.File) foo
=
class {float is_file;} ();})
+
test_compile(class { object(Stdio.File) foo
=
class { int is_file;} ();})
+
test_do(class { object foo; object(Stdio.File) bar=foo; })
+
test_do(class { object foo; Stdio.File bar=foo; })
+
test_do(class { object(Stdio.File) foo; object bar=foo; })
+
test_do(class { Stdio.File foo; object bar=foo; })
test_any(if(int i=1) return i; return 0;,1) test_compile(for(int i=0;i<100;i++) return 0;) test_compile(foreach(({}),mixed i){i;}) test_compile(sscanf("","%O",mixed foo);foo;) test_compile_error(sscanf("","",mixed foo);) test_compile_error(sscanf("","%f",float)) test_compile_error(sscanf("",float)) // ++ test_any([[int e; e++; return e;]],1)
pike.git/src/testsuite.in:6091:
void create() { for(int x=1;x<255;x++) { gurka=([]); for(int e=0;e<x;e++) gurka[~e]=e; gurka[Sallad()]=-2; gurka[Tomat()]=-3; } }
-
}();
+
}
+
X
();
]]) test_any([[ mapping m = ([ "foo" : 1 ]); class A { int __hash() { return hash_value("foo"); } int `==(mixed o) { return o == "foo"; } }; if( !m[A()] )
pike.git/src/testsuite.in:6346:
function bar = foo(); final_res += m->refs; // Should add 0 here. bar(); bar = 0; final_res += m->refs; // Should add 0 here. final_res += gc(); // Should add 0 here. return final_res; // 1 expected. ]], 1) test_true([[
-
class
Foo
+
class
{ object c; class A {object b;} class B {object a; void destroy() {c = class{}();}} mixed test() { object a = A(), b = B(); a->b = b; b->a = a; a = b = 0;
pike.git/src/testsuite.in:6428:
gc(); return set_weak_flag(m, 0); }]], ([])) test_any_equal([[{ array a = set_weak_flag(({4711, 0x54325827a124*0x12348795482485425}), 1); gc(); return set_weak_flag(a, 0); }]], ({4711, 0x54325827a124*0x12348795482485425})) test_any_equal([[{
-
object o = class
Live
{
+
object o = class {
array g; array a = ({17}); void create() {g = ({this});} void destroy() {all_constants()->kablutt = a;} }(); o = 0; gc(); return all_constants()->kablutt; }]], ({17})); test_any([[{
-
object o = class
Live
{
+
object o = class {
array g; array a = set_weak_flag (({({17})}), 1); void create() {g = ({this});} void destroy() { if (!equal (a, ({({17})}))) error ("Contents in weak array zapped: %O.\n", a); } }(); o = 0; return gc() >= 3; }]], 1); test_any_equal([[{
-
object o = class
Live
{
+
object o = class {
array g; array a = set_weak_flag (({({17})}), 1); void create() {g = ({this});} void destroy() {all_constants()->blatinka = a;} }(); o = 0; gc(); if (!equal (all_constants()->blatinka, ({({17})}))) error ("Contents in saved weak array zapped: %O.\n", all_constants()->blatinka);
pike.git/src/testsuite.in:7130:
test_true([[Pike.count_memory (-1, 17) == 0]]) test_true([[Pike.count_memory (-1, ({"some string with no other ref in memory "+ Standards.UUID.make_version4()->str()})) == Pike.count_memory (-1, ({""}))]]) test_true([[Pike.count_memory (0, ({"some string with no other ref in memory " + Standards.UUID.make_version4()->str()})) > Pike.count_memory (0, ({""}))]]) test_true([[Pike.count_memory (-1, ({time(1)})) + Pike.count_memory (-1, ([1: time(1)])) == Pike.count_memory (0, ({([1: time(1)])}))]])
-
test_true([[Pike.count_memory (0, class
X
{mapping(X:array(int)) x;}) >
-
Pike.count_memory (0, class
Y
{int x;})]])
+
test_true([[Pike.count_memory (0, class {mapping(X:array(int)) x;}) >
+
Pike.count_memory (0, class {int x;})]])
test_true([[Pike.count_memory (0, ({compile ( "constant x = ([1: " + time(1) + "]);")})) > Pike.count_memory (0, ({([1: time(1)])}))]]) test_eq([[count_memory_stats (-1, ({time(1)}))]], [["i:1,c:0,e:0,v:1,r:0,rnd:1"]]) test_eq([[count_memory_stats (-1, (<time(1)>))]], [["i:1,c:0,e:0,v:2,r:0,rnd:1"]]) test_eq([[count_memory_stats (-1, ([1: time(1)]))]], [["i:1,c:0,e:0,v:2,r:0,rnd:1"]])
pike.git/src/testsuite.in:7946:
array a=({k+17,k+16,k+13,k+14,k+12,k,k+9}); array b=({j+13,j+11,j-1,j+8,j+16,j+15,j+12}); return sizeof( a-b )]],0); ifefun(_verify_internals, [[ test_do(_verify_internals()) ]]) test_eq("\377"[0],255)
-
test_do(add_constant("foo",class
c
{int i;}()))
+
test_do(add_constant("foo",class {int i;}()))
test_eq(foo->i,0) test_do(foo->i=17) test_eq(foo->i,17) test_do(add_constant("foo"));
-
test_do(add_constant("foo",class
c
{array(int) i=({0});}()))
+
test_do(add_constant("foo",class {array(int) i=({0});}()))
test_eq(foo->i[0],0) test_do(foo->i[0]=17) test_eq(foo->i[0],17) test_do(add_constant("foo")); // signum, signame test_true(intp(signum("SIGKILL"))) // kill, signal, getpid test_true(intp(getpid()))
pike.git/src/testsuite.in:8000:
// class test_true(programp(class c {})) test_true(functionp(class c { int foo() { return 1; }}()->foo)) test_true(class c { int foo() { return 1; }}()->foo()) test_true(class c { int i=1; }()->i) test_false(class c { int foo() { return 1; }}()->bar) test_eq(class c { program foo=class c { int i=20; }; }()->foo()->i,20) // class()
-
test_true(programp(class
c
(){}))
-
test_equal(indices(class
c
(string a,protected int b){}("foo",0)), ({"a"}))
-
test_equal(values(class
c
(string a,protected int b){}("foo",0)), ({"foo"}))
-
test_true(programp(class
c
(string ... a){}))
-
test_equal(indices(class
c
(string a,protected int ... b){}("foo",0)), ({"a"}))
-
test_equal(values(class
c
(protected string a, int ... b){}("foo",0)), ({({0})}))
+
test_true(programp(class (){}))
+
test_equal(indices(class (string a,protected int b){}("foo",0)), ({"a"}))
+
test_equal(values(class (string a,protected int b){}("foo",0)), ({"foo"}))
+
test_true(programp(class (string ... a){}))
+
test_equal(indices(class (string a,protected int ... b){}("foo",0)), ({"a"}))
+
test_equal(values(class (protected string a, int ... b){}("foo",0)), ({({0})}))
test_do([[ class A (int i) {}; class B (int i, int j) {inherit A;}; class C {inherit B;}; C (1,1); ]]) // type checks test_compile_error([[} int foo() { return]]);
pike.git/src/testsuite.in:8769:
test_eq(([0:'f',1:'o',2:'o'])[0],'f') test_eq(([0:'f',1:'o',2:'o'])[1],'o') test_eq(([0:'f',1:'o',2:'o'])[2],'o') test_eq(([0:'f',1:'o',2:'o'])[random(0)+3],0) test_eq(([0:'f',1:'o',2:'o'])[random(0)-1],0) test_eq((<'f','o','o'>)['o'],1) test_eq((<'f','o','o'>)['f'],1) test_eq((<'f','o','o'>)[random(0)+'b'],0) test_eq((<'f','o','o'>)[ [int](mixed)-1],0)
-
test_eq([[class
Z
{ mixed `->(mixed x) { return this[x]; } int foo() { return 1; }}()->foo()]],1)
+
test_eq([[class { mixed `->(mixed x) { return this[x]; } int foo() { return 1; }}()->foo()]],1)
// Test some indexing opcodes. test_eval_error([[return ({1})[1];]]) test_eval_error([[int i = 1; return ({1})[i];]]) test_eval_error([[array a = ({ 1 }); return a[1];]]) test_eval_error([[array a = ({ 1 }); int i = 1; return a[i];]]) // index assigning test_any(mixed a=({1}); a[0]=2; return equal(a,({2})),1) test_any(mixed a=(<1>); a[1]=2; return equal(a,(<1>)),1)
pike.git/src/testsuite.in:12972:
test_program(inherit test2; inherit test; mixed a() { w=20; b=22; return getw()==20 && getb()==22; }) test_program(inherit test2; inherit test; mixed a() { setw(20); setb(22); return w==20 && b==22; }) test_do(add_constant("test")) test_do(add_constant("test2")) test_eval_error(return class c{int i;void foo(){ destruct(this_object());i=0;return i;}}()->foo()) test_eq(a,this_object()->a) // - catch
-
test_false([[class
X
{ string test(string foo) { catch { return lower_case(foo); }; return foo; }}()->test(0); ]])
+
test_false([[class { string test(string foo) { catch { return lower_case(foo); }; return foo; }}()->test(0); ]])
test_true([[catch (1.0 / 0.0)]]) test_true([[catch {float f = 1.0 / 0.0;}]]) // Pike modules // - this failed in Calendar.Timezone test_compile( [[