blob: c4f7cc47d5e42971b54f8f8187a915e994e3e7de (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
|
package org.shedlang.compiler.shidtopatio;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;
import org.shedlang.compiler.shid.instructions.ShidDeclareNativeFunction;
import org.shedlang.compiler.shid.instructions.ShidParam;
import org.shedlang.compiler.sources.Sources;
import org.shedlang.compiler.testing.snapshots.SnapshotResolver;
import org.shedlang.compiler.testing.snapshots.Snapshotter;
import org.shedlang.compiler.types.NamespaceName;
import java.io.IOException;
import java.util.List;
import static org.shedlang.compiler.shidtopatio.ShidToPatioTesting.serialize;
@ExtendWith({SnapshotResolver.class})
public class ShidToPatioDeclareNativeFunctionTests {
@Test
public void canDeclareNativeFunction(Snapshotter snapshotter) throws IOException {
var instruction = new ShidDeclareNativeFunction(
NamespaceName.of("Example", "Project"),
"f",
List.of(
new ShidParam("p1", Sources.NULL),
new ShidParam("p2", Sources.NULL)
),
List.of(
new ShidParam("n1", Sources.NULL),
new ShidParam("n2", Sources.NULL)
),
Sources.NULL
);
var context = ShidToPatioContext.EMPTY;
var result = ShidToPatio.generateInstruction(instruction, context);
snapshotter.assertSnapshot(serialize(result));
}
}
|