diff --git a/transpiler/src/test/java/org/jsweet/test/transpiler/NativeStructuresTests.java b/transpiler/src/test/java/org/jsweet/test/transpiler/NativeStructuresTests.java index d2848e51..5a0856fd 100644 --- a/transpiler/src/test/java/org/jsweet/test/transpiler/NativeStructuresTests.java +++ b/transpiler/src/test/java/org/jsweet/test/transpiler/NativeStructuresTests.java @@ -20,6 +20,7 @@ import source.nativestructures.ObjectMaps; import source.nativestructures.OverloadWithNative; import source.nativestructures.Properties; import source.nativestructures.Reflect; +import source.nativestructures.Sets; import source.nativestructures.Strings; import source.nativestructures.WeakReferences; @@ -38,6 +39,13 @@ public class NativeStructuresTests extends AbstractTest { }, getSourceFile(Collections.class)); } + @Test + public void testSets() { + eval((logHandler, result) -> { + logHandler.assertNoProblems(); + }, getSourceFile(Sets.class)); + } + @Test public void testStringBuilder() { eval((logHandler, result) -> { @@ -74,7 +82,8 @@ public class NativeStructuresTests extends AbstractTest { public void testMaps() { eval((logHandler, result) -> { 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)); } diff --git a/transpiler/src/test/java/source/nativestructures/Sets.java b/transpiler/src/test/java/source/nativestructures/Sets.java new file mode 100644 index 00000000..552dac82 --- /dev/null +++ b/transpiler/src/test/java/source/nativestructures/Sets.java @@ -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 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)); + } + +}