diff options
author | cushon <cushon@google.com> | 2018-10-25 16:41:49 -0700 |
---|---|---|
committer | Liam Miller-Cushon <cushon@google.com> | 2018-10-25 17:56:55 -0700 |
commit | 424f4517a7aa99f64a3981158fa0b753c1788b66 (patch) | |
tree | 8fbed3e8aaa9e107d7165c4c5a565e84fbac2b76 /javatests | |
parent | 483f08e08c55d908ed6d581ce1de70ccb9bfb524 (diff) | |
download | turbine-424f4517a7aa99f64a3981158fa0b753c1788b66.tar.gz |
Implement ClassValue equals and hashCode
(now that Type also implements equals and hashCode)
MOE_MIGRATED_REVID=218773629
Diffstat (limited to 'javatests')
-rw-r--r-- | javatests/com/google/turbine/model/ConstTest.java | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/javatests/com/google/turbine/model/ConstTest.java b/javatests/com/google/turbine/model/ConstTest.java index 9b34343..7940124 100644 --- a/javatests/com/google/turbine/model/ConstTest.java +++ b/javatests/com/google/turbine/model/ConstTest.java @@ -20,7 +20,10 @@ import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableMap; import com.google.common.testing.EqualsTester; import com.google.turbine.binder.bound.AnnotationValue; +import com.google.turbine.binder.bound.ClassValue; import com.google.turbine.binder.sym.ClassSymbol; +import com.google.turbine.type.Type.ClassTy; +import com.google.turbine.type.Type.PrimTy; import org.junit.Test; import org.junit.runner.RunWith; import org.junit.runners.JUnit4; @@ -68,6 +71,15 @@ public class ConstTest { new ClassSymbol("test/Anno"), ImmutableMap.of("value", new Const.IntValue(4))), new AnnotationValue( new ClassSymbol("test/Anno"), ImmutableMap.of("value", new Const.IntValue(4)))) + .addEqualityGroup( + new ClassValue(ClassTy.asNonParametricClassTy(new ClassSymbol("test/Clazz"))), + new ClassValue(ClassTy.asNonParametricClassTy(new ClassSymbol("test/Clazz")))) + .addEqualityGroup( + new ClassValue(ClassTy.asNonParametricClassTy(new ClassSymbol("test/Other"))), + new ClassValue(ClassTy.asNonParametricClassTy(new ClassSymbol("test/Other")))) + .addEqualityGroup( + new ClassValue(PrimTy.create(TurbineConstantTypeKind.INT, ImmutableList.of())), + new ClassValue(PrimTy.create(TurbineConstantTypeKind.INT, ImmutableList.of()))) .testEquals(); } } |