• R/O
  • SSH

kink: Commit

Kink runtime


Commit MetaInfo

Révisionca48c1e303d6f02a790f730eb1bbcb11a32f70ee (tree)
l'heure2023-01-26 01:36:03
Auteurmiyakawataku
Commitermiyakawataku

Message de Log

make test not dependent on AllocationSet interface

Change Summary

Modification

diff -r 80a05a1a4fbf -r ca48c1e303d6 src/test/java/org/kink_lang/kink/internal/compile/javaclassir/FastLvarAccessGeneratorTest.java
--- a/src/test/java/org/kink_lang/kink/internal/compile/javaclassir/FastLvarAccessGeneratorTest.java Thu Jan 26 01:29:44 2023 +0900
+++ b/src/test/java/org/kink_lang/kink/internal/compile/javaclassir/FastLvarAccessGeneratorTest.java Thu Jan 26 01:36:03 2023 +0900
@@ -16,9 +16,6 @@
1616 import static org.assertj.core.api.Assertions.assertThat;
1717 import static org.assertj.core.api.Assertions.assertThatThrownBy;
1818
19-import static org.mockito.Mockito.mock;
20-import static org.mockito.Mockito.when;
21-
2219 import org.kink_lang.kink.Val;
2320 import org.kink_lang.kink.internal.callstack.Location;
2421 import org.kink_lang.kink.internal.callstack.Trace;
@@ -103,25 +100,31 @@
103100
104101 @Test
105102 public void load_nullable_stack_lvar() {
106- AllocationSet allocationSet = mock(AllocationSet.class);
103+ ValCaptureAllocationSet allocationSet = new ValCaptureAllocationSet(
104+ Set.of(),
105+ Map.of(),
106+ Set.of(),
107+ List.of(),
108+ List.of(
109+ new LocalVar.Original("X"),
110+ new LocalVar.Original("Y"),
111+ new LocalVar.Original("Sn")));
107112 LvarAccessGenerator accGen = new FastLvarAccessGenerator(
108113 allocationSet,
109114 new KeyStrSupplier(),
110115 traceAccum);
111116
112- when(allocationSet.get(new LocalVar.Original("Sn")))
113- .thenReturn(new Allocation.Stack(42, false));
114117 var insns = accGen.loadLvar(
115118 new LocalVar.Original("Sn"),
116119 new Location("f.kn", "x", 0));
117120 assertThat(insns).containsExactly(
118121 // (dataStack)
119122 InsnsGenerator.LOAD_DATASTACK,
120- // (dataStack 1+42)
121- new Insn.PushInt(43),
122- // (dataStack 1+42 argCount)
123+ // (dataStack 1+2)
124+ new Insn.PushInt(3),
125+ // (dataStack 1+2 argCount)
123126 InsnsGenerator.LOAD_ARGCOUNT,
124- // (dataStack 1+42+argCount)
127+ // (dataStack 1+2+argCount)
125128 new Insn.AddInt(),
126129 // (lvar)
127130 new Insn.InvokeVirtual(Type.getType("Lorg/kink_lang/kink/DataStack;"),
Afficher sur ancien navigateur de dépôt.