From: Jean-Sebastien Gelinas Date: Mon, 7 Dec 2009 05:10:19 +0000 (-0500) Subject: tests: add some basic tests for dead method removal/cha/rta X-Git-Tag: v0.4~73 X-Git-Url: http://nitlanguage.org tests: add some basic tests for dead method removal/cha/rta Signed-off-by: Jean-Sebastien Gelinas Signed-off-by: Jean Privat --- diff --git a/tests/icode_dmr_if.nit b/tests/icode_dmr_if.nit new file mode 100644 index 0000000..cf1ae4c --- /dev/null +++ b/tests/icode_dmr_if.nit @@ -0,0 +1,17 @@ + +class A + fun foo do + print "foo" + end + + fun bar do + print "bar" + end +end + +var a = new A +if true then + a.foo +#alt1#else +#alt1# a.bar +end diff --git a/tests/icode_dmr_if.tests b/tests/icode_dmr_if.tests new file mode 100644 index 0000000..c957da8 --- /dev/null +++ b/tests/icode_dmr_if.tests @@ -0,0 +1,4 @@ +A,icode_dmr_if::A::foo,has,CALL file::Object::print +A,icode_dmr_if::A::bar,no,CALL file::Object::print +A,icode_dmr_if::A::foo,no,ABORT +A,icode_dmr_if::A::bar,has,ABORT diff --git a/tests/icode_dmr_if_alt1.tests b/tests/icode_dmr_if_alt1.tests new file mode 100644 index 0000000..463fe96 --- /dev/null +++ b/tests/icode_dmr_if_alt1.tests @@ -0,0 +1,4 @@ +A,icode_dmr_if_alt1::A::foo,has,CALL file::Object::print +A,icode_dmr_if_alt1::A::bar,has,CALL file::Object::print +A,icode_dmr_if_alt1::A::foo,no,ABORT +A,icode_dmr_if_alt1::A::bar,no,ABORT diff --git a/tests/icode_dmr_inh.nit b/tests/icode_dmr_inh.nit new file mode 100644 index 0000000..02a1752 --- /dev/null +++ b/tests/icode_dmr_inh.nit @@ -0,0 +1,20 @@ +class B + fun foo do + print "bfoo" + end +end + +class A +special B + redef fun foo do + print "afoo" + end +end + +var o: B +#alt1#o = new B +#alt2#o = new B +#alt3#o = new B +#alt3#o.foo +o = new A#!alt2# +o.foo diff --git a/tests/icode_dmr_inh.tests b/tests/icode_dmr_inh.tests new file mode 100644 index 0000000..c72bcd5 --- /dev/null +++ b/tests/icode_dmr_inh.tests @@ -0,0 +1,3 @@ +A,icode_dmr_inh::B::foo,has,CALL file::Object::print +A,icode_dmr_inh::B::foo,no,ABORT +B,no-file diff --git a/tests/icode_dmr_inh_alt1.tests b/tests/icode_dmr_inh_alt1.tests new file mode 100644 index 0000000..1e00c54 --- /dev/null +++ b/tests/icode_dmr_inh_alt1.tests @@ -0,0 +1,4 @@ +A,icode_dmr_inh_alt1::B::foo,has,CALL file::Object::print +A,icode_dmr_inh_alt1::B::foo,no,ABORT +B,icode_dmr_inh_alt1::B::foo,no,CALL file::Object::print +B,icode_dmr_inh_alt1::B::foo,has,ABORT diff --git a/tests/icode_dmr_inh_alt2.tests b/tests/icode_dmr_inh_alt2.tests new file mode 100644 index 0000000..3ec1976 --- /dev/null +++ b/tests/icode_dmr_inh_alt2.tests @@ -0,0 +1,3 @@ +A,no-file +B,icode_dmr_inh_alt2::B::foo,has,CALL file::Object::print +B,icode_dmr_inh_alt2::B::foo,no,ABORT diff --git a/tests/icode_dmr_inh_alt3.tests b/tests/icode_dmr_inh_alt3.tests new file mode 100644 index 0000000..5a45e05 --- /dev/null +++ b/tests/icode_dmr_inh_alt3.tests @@ -0,0 +1,4 @@ +A,icode_dmr_inh_alt3::B::foo,has,CALL file::Object::print +A,icode_dmr_inh_alt3::B::foo,no,ABORT +B,icode_dmr_inh_alt3::B::foo,has,CALL file::Object::print +B,icode_dmr_inh_alt3::B::foo,no,ABORT diff --git a/tests/icode_dmr_simple.nit b/tests/icode_dmr_simple.nit new file mode 100644 index 0000000..5d3e6eb --- /dev/null +++ b/tests/icode_dmr_simple.nit @@ -0,0 +1,16 @@ + +class A + fun foo do + #alt2#bar + print "foo" + end + + fun bar do + #alt3#foo + print "bar" + end +end + +var a = new A +a.foo +#alt1#a.bar diff --git a/tests/icode_dmr_simple.tests b/tests/icode_dmr_simple.tests new file mode 100644 index 0000000..4898d0b --- /dev/null +++ b/tests/icode_dmr_simple.tests @@ -0,0 +1,4 @@ +A,icode_dmr_simple::A::foo,has,CALL file::Object::print +A,icode_dmr_simple::A::bar,no,CALL file::Object::print +A,icode_dmr_simple::A::foo,no,ABORT +A,icode_dmr_simple::A::bar,has,ABORT diff --git a/tests/icode_dmr_simple_alt1.tests b/tests/icode_dmr_simple_alt1.tests new file mode 100644 index 0000000..61fe040 --- /dev/null +++ b/tests/icode_dmr_simple_alt1.tests @@ -0,0 +1,4 @@ +A,icode_dmr_simple_alt1::A::foo,has,CALL file::Object::print +A,icode_dmr_simple_alt1::A::bar,has,CALL file::Object::print +A,icode_dmr_simple_alt1::A::foo,no,ABORT +A,icode_dmr_simple_alt1::A::bar,no,ABORT diff --git a/tests/icode_dmr_simple_alt2.tests b/tests/icode_dmr_simple_alt2.tests new file mode 100644 index 0000000..68db1f8 --- /dev/null +++ b/tests/icode_dmr_simple_alt2.tests @@ -0,0 +1,4 @@ +A,icode_dmr_simple_alt2::A::foo,has,CALL file::Object::print +A,icode_dmr_simple_alt2::A::bar,has,CALL file::Object::print +A,icode_dmr_simple_alt2::A::foo,no,ABORT +A,icode_dmr_simple_alt2::A::bar,no,ABORT diff --git a/tests/icode_dmr_simple_alt3.tests b/tests/icode_dmr_simple_alt3.tests new file mode 100644 index 0000000..db8392e --- /dev/null +++ b/tests/icode_dmr_simple_alt3.tests @@ -0,0 +1,4 @@ +A,icode_dmr_simple_alt3::A::foo,has,CALL file::Object::print +A,icode_dmr_simple_alt3::A::bar,no,CALL file::Object::print +A,icode_dmr_simple_alt3::A::foo,no,ABORT +A,icode_dmr_simple_alt3::A::bar,has,ABORT diff --git a/tests/sav/icode_dmr_if.sav b/tests/sav/icode_dmr_if.sav new file mode 100644 index 0000000..257cc56 --- /dev/null +++ b/tests/sav/icode_dmr_if.sav @@ -0,0 +1 @@ +foo diff --git a/tests/sav/icode_dmr_if_alt1.sav b/tests/sav/icode_dmr_if_alt1.sav new file mode 100644 index 0000000..257cc56 --- /dev/null +++ b/tests/sav/icode_dmr_if_alt1.sav @@ -0,0 +1 @@ +foo diff --git a/tests/sav/icode_dmr_inh.sav b/tests/sav/icode_dmr_inh.sav new file mode 100644 index 0000000..cf18a45 --- /dev/null +++ b/tests/sav/icode_dmr_inh.sav @@ -0,0 +1 @@ +afoo diff --git a/tests/sav/icode_dmr_inh_alt1.sav b/tests/sav/icode_dmr_inh_alt1.sav new file mode 100644 index 0000000..cf18a45 --- /dev/null +++ b/tests/sav/icode_dmr_inh_alt1.sav @@ -0,0 +1 @@ +afoo diff --git a/tests/sav/icode_dmr_inh_alt2.sav b/tests/sav/icode_dmr_inh_alt2.sav new file mode 100644 index 0000000..91dd06e --- /dev/null +++ b/tests/sav/icode_dmr_inh_alt2.sav @@ -0,0 +1 @@ +bfoo diff --git a/tests/sav/icode_dmr_inh_alt3.sav b/tests/sav/icode_dmr_inh_alt3.sav new file mode 100644 index 0000000..359eb0f --- /dev/null +++ b/tests/sav/icode_dmr_inh_alt3.sav @@ -0,0 +1,2 @@ +bfoo +afoo diff --git a/tests/sav/icode_dmr_simple.sav b/tests/sav/icode_dmr_simple.sav new file mode 100644 index 0000000..257cc56 --- /dev/null +++ b/tests/sav/icode_dmr_simple.sav @@ -0,0 +1 @@ +foo diff --git a/tests/sav/icode_dmr_simple_alt1.sav b/tests/sav/icode_dmr_simple_alt1.sav new file mode 100644 index 0000000..3bd1f0e --- /dev/null +++ b/tests/sav/icode_dmr_simple_alt1.sav @@ -0,0 +1,2 @@ +foo +bar diff --git a/tests/sav/icode_dmr_simple_alt2.sav b/tests/sav/icode_dmr_simple_alt2.sav new file mode 100644 index 0000000..1289765 --- /dev/null +++ b/tests/sav/icode_dmr_simple_alt2.sav @@ -0,0 +1,2 @@ +bar +foo diff --git a/tests/sav/icode_dmr_simple_alt3.sav b/tests/sav/icode_dmr_simple_alt3.sav new file mode 100644 index 0000000..257cc56 --- /dev/null +++ b/tests/sav/icode_dmr_simple_alt3.sav @@ -0,0 +1 @@ +foo