mirror of
https://github.com/cincheo/jsweet.git
synced 2025-12-15 07:19:22 +00:00
added a first test for sets
This commit is contained in:
parent
a52ea53162
commit
75022df498
@ -20,6 +20,7 @@ import source.nativestructures.ObjectMaps;
|
|||||||
import source.nativestructures.OverloadWithNative;
|
import source.nativestructures.OverloadWithNative;
|
||||||
import source.nativestructures.Properties;
|
import source.nativestructures.Properties;
|
||||||
import source.nativestructures.Reflect;
|
import source.nativestructures.Reflect;
|
||||||
|
import source.nativestructures.Sets;
|
||||||
import source.nativestructures.Strings;
|
import source.nativestructures.Strings;
|
||||||
import source.nativestructures.WeakReferences;
|
import source.nativestructures.WeakReferences;
|
||||||
|
|
||||||
@ -38,6 +39,13 @@ public class NativeStructuresTests extends AbstractTest {
|
|||||||
}, getSourceFile(Collections.class));
|
}, getSourceFile(Collections.class));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testSets() {
|
||||||
|
eval((logHandler, result) -> {
|
||||||
|
logHandler.assertNoProblems();
|
||||||
|
}, getSourceFile(Sets.class));
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testStringBuilder() {
|
public void testStringBuilder() {
|
||||||
eval((logHandler, result) -> {
|
eval((logHandler, result) -> {
|
||||||
@ -74,7 +82,8 @@ public class NativeStructuresTests extends AbstractTest {
|
|||||||
public void testMaps() {
|
public void testMaps() {
|
||||||
eval((logHandler, result) -> {
|
eval((logHandler, result) -> {
|
||||||
Assert.assertEquals("There should be no errors", 0, logHandler.reportedProblems.size());
|
Assert.assertEquals("There should be no errors", 0, logHandler.reportedProblems.size());
|
||||||
assertEquals("1,a,2,b,2,a,true,[1, 2],[a, b],1,true,size2=2,1,2,[],empty=true,-null-,1,a,2,b", result.get("trace"));
|
assertEquals("1,a,2,b,2,a,true,[1, 2],[a, b],1,true,size2=2,1,2,[],empty=true,-null-,1,a,2,b",
|
||||||
|
result.get("trace"));
|
||||||
}, getSourceFile(Maps.class));
|
}, getSourceFile(Maps.class));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
26
transpiler/src/test/java/source/nativestructures/Sets.java
Normal file
26
transpiler/src/test/java/source/nativestructures/Sets.java
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
package source.nativestructures;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.HashSet;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
|
public class Sets {
|
||||||
|
|
||||||
|
public static void main(String[] args) {
|
||||||
|
Map<Set, String> map = new HashMap<>();
|
||||||
|
Set s = new HashSet();
|
||||||
|
s.add("1");
|
||||||
|
s.add("2");
|
||||||
|
Set s2 = new HashSet();
|
||||||
|
s2.add("2");
|
||||||
|
s2.add("1");
|
||||||
|
map.put(s, "hi");
|
||||||
|
map.put(s2, "bye");
|
||||||
|
|
||||||
|
System.out.println(map.get(s));
|
||||||
|
// TODO: make this work (see #196)
|
||||||
|
// assert "bye".equals(map.get(s));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
Loading…
x
Reference in New Issue
Block a user