Skip to content
Permalink
Browse files
8268584: [lqagain] Javac tests should not needlessly hardcode toStrin…
…g() output
  • Loading branch information
Srikanth Adayapalam committed Jun 11, 2021
1 parent d23562e commit 64ec4ecfd42c5e005d44948efbd119081b44896b
@@ -47,11 +47,11 @@
}
public static void main(String[] args) {
Point p = new Point();
if (!p.toString().equals("[ChainedAssignmentTest$Point x=1234 y=1234]"))
if (p.x != 1234 || p.y != 1234)
throw new AssertionError("Broken");

LongPoint lp = new LongPoint();
if (!lp.toString().equals("[ChainedAssignmentTest$LongPoint x=1234 y=1234]"))
if (lp.x != 1234 || lp.y != 1234)
throw new AssertionError("Broken");
}
}
@@ -30,9 +30,8 @@
*/

public class CheckSeparateCompile {
public static void main(String[] args) {
String s = new CheckSeparateCompile0().new O().new M().new I().foo();
if (!s.equals("[CheckSeparateCompile0$O$M$I i=0]"))
throw new AssertionError(s);
}
public static void main(String[] args) {
if (new CheckSeparateCompile0().new O().new M().new I().foo().i != 890)
throw new AssertionError("Broken");
}
}
@@ -32,12 +32,12 @@
public class M {
int m = 789;
public primitive class I {
int i = 0;
int i = 890;
I() {

}
String foo() {
return this.toString();
I foo() {
return this;
}
}
public String toString() {
@@ -55,8 +55,8 @@
}

public static void main(String [] args) {
String o = new CtorChain().toString();
if (!o.equals("[CtorChain x1=10 x2=20 x3=30 x4=40 x5=50]"))
CtorChain cc = new CtorChain();
if (cc.x1 != 10 || cc.x2 != 20 || cc.x3 != 30 || cc.x4 != 40 || cc.x5 != 50)
throw new AssertionError("Broken");
}
}
@@ -33,7 +33,7 @@
public primitive class InlineClassTest {
int x = 42;
public static void main(String [] args) {
if (!new InlineClassTest().toString().equals("[InlineClassTest x=42]"))
if (new InlineClassTest().x != 42)
throw new AssertionError("Unexpected state");
}
}
@@ -31,12 +31,12 @@
primitive class A {
int x = 1000000;
class Inner {
String aDotThis;
A aDotThis;
Inner() {
aDotThis = A.this.toString();
aDotThis = A.this;
}

String getADotThis() {
A getADotThis() {
return aDotThis;
}
}
@@ -48,7 +48,7 @@ String getADotThis() {
}

public static void main(String [] args) {
if (!new QualifiedSuperCtor(new A()).getADotThis().equals("[A x=1000000]"))
if (new QualifiedSuperCtor(new A()).getADotThis().x !=1000000)
throw new AssertionError("Broken");
}
}
@@ -55,12 +55,12 @@ public static void main(String[] args) {
V v = new V();
if (!v.output.equals("1234"))
throw new AssertionError("Broken");
if (!v.toString().equals("[SideEffectTest$V x=1234]"))
if (v.x != 1234)
throw new AssertionError("Broken");
v = new V(8765);
if (!v.output.equals("12349999"))
throw new AssertionError("Broken");
if (!v.toString().equals("[SideEffectTest$V x=8765]"))
if (v.x != 8765)
throw new AssertionError("Broken");
}
}
@@ -42,7 +42,7 @@ public TestValue1(int x) {
public class TestQualifierOnInit {
static public void main(String[] args) {
TestValue1 testValue1 = new TestValue1(42);
if (!testValue1.toString().equals("[TestValue1 x=42]"))
if (testValue1.x != 42)
throw new AssertionError("unexpected " + testValue1);
}
}
@@ -44,7 +44,7 @@
public static void main(String [] args) {
Supplier<ValueConstructorRef.ref> sx = ValueConstructorRef::new;
ValueConstructorRef x = (ValueConstructorRef) sx.get();
if (!x.toString().equals("[ValueConstructorRef x=1234 y=5678]"))
if (x.x != 1234 || x.y != 5678)
throw new AssertionError(x);
}
}
@@ -46,7 +46,7 @@ public static V make(int i) {

public static void main(String... args) throws Throwable {
V v = __WithField(V.make(10).i, 20);
if (!v.toString().equals("[WithFieldAccessorTest$V i=20]"))
throw new AssertionError("Withfield didn't work!" + v.toString());
if (v.i != 20)
throw new AssertionError("Withfield didn't work!");
}
}
@@ -45,7 +45,7 @@ private WithFieldOfGenericType() {

public static void main(String[] args) {
WithFieldOfGenericType<String> w = create();
if (!w.toString().equals("[WithFieldOfGenericType value=true]"))
if (w.value != true)
throw new AssertionError("Withfield didn't work!");
}
}

0 comments on commit 64ec4ec

Please sign in to comment.