made a simple script to test these classes automatically git-svn-id: https://svn.code.sf.net/p/jode/code/trunk@1149 379699f6-c40d-0410-875b-85095c16579ebranch_1_1
parent
15e5e76033
commit
75cc1c2c9d
@ -1,112 +0,0 @@ |
||||
/* Conflicts Copyright (C) 1999 Jochen Hoenicke. |
||||
* |
||||
* This program is free software; you can redistribute it and/or modify |
||||
* it under the terms of the GNU General Public License as published by |
||||
* the Free Software Foundation; either version 2, or (at your option) |
||||
* any later version. |
||||
* |
||||
* This program is distributed in the hope that it will be useful, |
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||
* GNU General Public License for more details. |
||||
* |
||||
* You should have received a copy of the GNU General Public License |
||||
* along with this program; see the file COPYING. If not, write to |
||||
* the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. |
||||
* |
||||
* $Id$ |
||||
*/ |
||||
|
||||
package jode.test; |
||||
|
||||
/** |
||||
* This class tests name conflicts and their resolvation. Note that every |
||||
* name in this file should be the shortest possible name. |
||||
*/ |
||||
public class Conflicts |
||||
{ |
||||
int Conflicts; |
||||
|
||||
class Blah |
||||
{ |
||||
Conflicts Inner; |
||||
|
||||
void Conflicts() { |
||||
Inner = jode.test.Conflicts.this; |
||||
} |
||||
} |
||||
|
||||
class Inner |
||||
{ |
||||
int Conflicts; |
||||
Conflicts Inner; |
||||
|
||||
class Blah |
||||
extends Conflicts.Blah |
||||
{ |
||||
int Blah; |
||||
|
||||
void Inner() { |
||||
this.Inner.Inner(); |
||||
// jode.test.Conflicts.Inner.this.Inner.Inner();
|
||||
this.Conflicts(); |
||||
// jode.test.Conflicts.Inner.this.Conflicts();
|
||||
} |
||||
|
||||
Blah() { |
||||
/* empty */ |
||||
} |
||||
|
||||
Blah(Conflicts Conflicts) { |
||||
Conflicts.super(); |
||||
} |
||||
} |
||||
|
||||
void Conflicts() { |
||||
int Conflicts = 4; |
||||
Conflicts(); |
||||
new Object() { |
||||
void Inner() { |
||||
jode.test.Conflicts.this.Inner(); |
||||
} |
||||
}; |
||||
this.Conflicts = Conflicts; |
||||
Inner(); |
||||
jode.test.Conflicts.this.Conflicts = this.Conflicts; |
||||
} |
||||
|
||||
Conflicts Conflicts(Inner Conflicts) { |
||||
// Conflicts.this$0.Conflicts = 9;
|
||||
return jode.test.Conflicts.this; |
||||
} |
||||
} |
||||
|
||||
class Second |
||||
extends Conflicts.Inner.Blah |
||||
{ |
||||
Inner Blah = new Inner(); |
||||
|
||||
class Inner extends Conflicts.Inner |
||||
{ |
||||
} |
||||
|
||||
Conflicts.Inner create() { |
||||
return jode.test.Conflicts.this.new Inner(); |
||||
} |
||||
|
||||
Second(Conflicts.Inner Blah) { |
||||
Blah.super(); |
||||
} |
||||
} |
||||
|
||||
public void Inner() { |
||||
/* empty */ |
||||
} |
||||
|
||||
public Conflicts() { |
||||
int Conflicts = this.Conflicts; |
||||
Inner Inner = new Inner(); |
||||
Inner.Conflicts = 5; |
||||
new Inner().Conflicts(Inner).Inner(); |
||||
} |
||||
} |
@ -0,0 +1,6 @@ |
||||
JAVA = @JAVA@
|
||||
JAVAC = @JAVAC@
|
||||
JFLAGS =
|
||||
TESTS_ENVIRONMENT=JAVA=$(JAVA) JAVAC=$(JAVAC) JFLAGS=$(JFLAGS) srcdir=$(srcdir) top_srcdir=$(top_srcdir) top_builddir=$(top_builddir)
|
||||
|
||||
TESTS = simpletests.sh
|
@ -0,0 +1,112 @@ |
||||
/* Conflicts Copyright (C) 1999 Jochen Hoenicke. |
||||
* |
||||
* This program is free software; you can redistribute it and/or modify |
||||
* it under the terms of the GNU General Public License as published by |
||||
* the Free Software Foundation; either version 2, or (at your option) |
||||
* any later version. |
||||
* |
||||
* This program is distributed in the hope that it will be useful, |
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||
* GNU General Public License for more details. |
||||
* |
||||
* You should have received a copy of the GNU General Public License |
||||
* along with this program; see the file COPYING. If not, write to |
||||
* the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. |
||||
* |
||||
* $Id$ |
||||
*/ |
||||
|
||||
/** |
||||
* This class tests name conflicts and their resolvation. Note that every |
||||
* name in this file should be the shortest possible name. |
||||
*/ |
||||
public class ResolveConflicts |
||||
{ |
||||
public class Conflicts |
||||
{ |
||||
int Conflicts; |
||||
|
||||
class Blah |
||||
{ |
||||
Conflicts Inner; |
||||
|
||||
void Conflicts() { |
||||
Inner = ResolveConflicts.Conflicts.this; |
||||
} |
||||
} |
||||
|
||||
class Inner |
||||
{ |
||||
int Conflicts; |
||||
Conflicts Inner; |
||||
|
||||
class Blah |
||||
extends Conflicts.Blah |
||||
{ |
||||
int Blah; |
||||
|
||||
void Inner() { |
||||
this.Inner.Inner(); |
||||
ResolveConflicts.Conflicts.Inner.this.Inner.Inner(); |
||||
this.Conflicts(); |
||||
ResolveConflicts.Conflicts.Inner.this.Conflicts(); |
||||
} |
||||
|
||||
Blah() { |
||||
/* empty */ |
||||
} |
||||
|
||||
Blah(Conflicts Conflicts) { |
||||
Conflicts.super(); |
||||
} |
||||
} |
||||
|
||||
void Conflicts() { |
||||
int Conflicts = 4; |
||||
Conflicts(); |
||||
new Object() { |
||||
void Inner() { |
||||
ResolveConflicts.Conflicts.this.Inner(); |
||||
} |
||||
}; |
||||
this.Conflicts = Conflicts; |
||||
Inner(); |
||||
ResolveConflicts.Conflicts.this.Conflicts = this.Conflicts; |
||||
} |
||||
|
||||
Conflicts Conflicts(Inner Conflicts) { |
||||
return ResolveConflicts.Conflicts.this; |
||||
} |
||||
} |
||||
|
||||
class Second |
||||
extends Conflicts.Inner.Blah |
||||
{ |
||||
Inner Blah = new Inner(); |
||||
|
||||
class Inner extends Conflicts.Inner |
||||
{ |
||||
} |
||||
|
||||
Conflicts.Inner create() { |
||||
return ResolveConflicts.Conflicts.this.new Inner(); |
||||
} |
||||
|
||||
Second(Conflicts.Inner Blah) { |
||||
Blah.super(); |
||||
} |
||||
} |
||||
|
||||
public void Inner() { |
||||
/* empty */ |
||||
} |
||||
|
||||
public Conflicts() { |
||||
int Conflicts = this.Conflicts; |
||||
Inner Inner = new Inner(); |
||||
Inner.Conflicts = 5; |
||||
new Inner().Conflicts(Inner).Inner(); |
||||
} |
||||
} |
||||
} |
@ -0,0 +1,66 @@ |
||||
#!/bin/sh |
||||
|
||||
TEMP=`mktemp -d tmp.XXXXXX` |
||||
|
||||
if echo $JAVAC | grep jikes >/dev/null; then |
||||
compiler=JIKES; |
||||
elif echo $JAVAC | grep javac >/dev/null; then |
||||
compiler=`$JAVAC -J-version 2>&1 | grep version | \ |
||||
perl -pe's/^.*version \"?([0-9]+)\.([0-9]+).*$/JAVAC\1\2/'` |
||||
else |
||||
compiler=UNKNOWN |
||||
fi |
||||
|
||||
echo "detected compiler $compiler" |
||||
|
||||
error="" |
||||
|
||||
EXPECT_FAIL="ResolveConflicts.java AnonymousClass.java InnerClass.java" |
||||
|
||||
for testclass in \ |
||||
ArrayCloneTest.java \ |
||||
ArrayTest.java \ |
||||
AssignOp.java \ |
||||
ClassOpTest.java \ |
||||
ConstantTypes.java \ |
||||
Expressions.java \ |
||||
Flow.java \ |
||||
For.java \ |
||||
HintTypeTest.java \ |
||||
IfCombine.java \ |
||||
LocalTypes.java \ |
||||
ResolveConflicts.java \ |
||||
TriadicExpr.java \ |
||||
TryCatch.java \ |
||||
Unreach.java \ |
||||
AnonymousClass.java \ |
||||
InnerClass.java \ |
||||
InnerCompat.java \ |
||||
NestedAnon.java |
||||
do |
||||
cp $srcdir/$testclass $TEMP |
||||
$top_srcdir/jcpp -D$compiler $TEMP/$testclass |
||||
$JAVAC $JFLAGS -d $TEMP $TEMP/$testclass |
||||
CLASSPATH=$top_builddir:$CLASSPATH $JAVA jode.Decompiler \ |
||||
--classpath=$TEMP --dest=$TEMP ${testclass%.java} &> $testclass.log |
||||
if ! CLASSPATH=$TEMP:$CLASSPATH $JAVAC $JFLAGS -d $TEMP $TEMP/$testclass >> $testclass.log 2>&1 ; then |
||||
cat $TEMP/$testclass >> $testclass.log |
||||
CLASSPATH=$TEMP:$CLASSPATH javap -c ${testclass%.java} >> $testclass.log |
||||
if ! echo $EXPECT_FAIL | grep $testclass >/dev/null ; then |
||||
error="$error $testclass"; |
||||
echo "FAIL: $testclass" |
||||
else |
||||
echo "EXPECTED FAIL: $testclass" |
||||
fi |
||||
else |
||||
echo "PASS: $testclass" |
||||
rm $testclass.log |
||||
fi |
||||
#rm -rf $TEMP/* |
||||
done |
||||
|
||||
rm -rf $TEMP; |
||||
|
||||
if [ -n "$error" ]; then |
||||
exit 1; |
||||
fi |
Loading…
Reference in new issue