Mercurial > hg > truffle
comparison truffle/com.oracle.truffle.api.test/src/com/oracle/truffle/api/FrameDescriptorTest.java @ 22490:fa86f9f3848d
change FrameDescriptor#copy to also copy info
author | Andreas Woess <andreas.woess@oracle.com> |
---|---|
date | Thu, 10 Dec 2015 18:51:41 +0100 |
parents | dc2bfc816011 |
children | bc3303fb3888 |
comparison
equal
deleted
inserted
replaced
22489:28227895fa35 | 22490:fa86f9f3848d |
---|---|
20 * or visit www.oracle.com if you need additional information or have any | 20 * or visit www.oracle.com if you need additional information or have any |
21 * questions. | 21 * questions. |
22 */ | 22 */ |
23 package com.oracle.truffle.api; | 23 package com.oracle.truffle.api; |
24 | 24 |
25 import static org.junit.Assert.assertEquals; | |
26 | |
27 import org.junit.Assert; | |
28 import org.junit.Test; | |
29 | |
25 import com.oracle.truffle.api.frame.Frame; | 30 import com.oracle.truffle.api.frame.Frame; |
26 import com.oracle.truffle.api.frame.FrameDescriptor; | 31 import com.oracle.truffle.api.frame.FrameDescriptor; |
27 import com.oracle.truffle.api.frame.FrameSlot; | 32 import com.oracle.truffle.api.frame.FrameSlot; |
28 import com.oracle.truffle.api.frame.FrameSlotKind; | 33 import com.oracle.truffle.api.frame.FrameSlotKind; |
29 import com.oracle.truffle.api.frame.FrameSlotTypeException; | 34 import com.oracle.truffle.api.frame.FrameSlotTypeException; |
30 import com.oracle.truffle.api.frame.VirtualFrame; | 35 import com.oracle.truffle.api.frame.VirtualFrame; |
31 import org.junit.Assert; | |
32 import static org.junit.Assert.assertEquals; | |
33 import static org.junit.Assert.assertNull; | |
34 import org.junit.Test; | |
35 | 36 |
36 public class FrameDescriptorTest { | 37 public class FrameDescriptorTest { |
37 | 38 |
38 private FrameSlot s1; | 39 private FrameSlot s1; |
39 private FrameSlot s2; | 40 private FrameSlot s2; |
80 assertEquals(d.getSlots().get(1).getInfo(), "i2"); | 81 assertEquals(d.getSlots().get(1).getInfo(), "i2"); |
81 assertEquals(d.getSlots().get(1).getKind(), FrameSlotKind.Float); | 82 assertEquals(d.getSlots().get(1).getKind(), FrameSlotKind.Float); |
82 assertEquals(d.getSlots().get(1).getIndex(), 1); | 83 assertEquals(d.getSlots().get(1).getIndex(), 1); |
83 | 84 |
84 FrameDescriptor copy = d.copy(); | 85 FrameDescriptor copy = d.copy(); |
85 | 86 assertEquals(2, copy.getSize()); |
86 assertEquals(copy.getSlots().get(1).getIndex(), 1); | 87 assertEquals(1, copy.getSlots().get(1).getIndex()); |
87 | 88 assertEquals("Info is copied", "i2", copy.getSlots().get(1).getInfo()); |
88 assertNull("Info isn't copied!", copy.getSlots().get(1).getInfo()); | 89 assertEquals("Kind isn't copied", FrameSlotKind.Illegal, copy.getSlots().get(1).getKind()); |
89 assertEquals("Kind isn't copied!", copy.getSlots().get(1).getKind(), FrameSlotKind.Illegal); | |
90 } | 90 } |
91 | 91 |
92 @Test | 92 @Test |
93 public void shallowCopy() { | 93 public void shallowCopy() { |
94 Object defaultValue = "default"; | 94 Object defaultValue = "default"; |