Skip to content

Commit 17be493

Browse files
Add integration tests
1 parent 6b664ee commit 17be493

File tree

11 files changed

+94
-0
lines changed

11 files changed

+94
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
aqua LibA.SubA declares f
2+
3+
func f() -> i32:
4+
<- 37
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
aqua LibAB declares LibA, LibB
2+
3+
use "libA"
4+
use "libB"
5+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
aqua LibB.SubB declares g
2+
3+
func g() -> i32:
4+
<- 73
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
aqua Export.Me.Please declares exp
2+
3+
func exp() -> i32:
4+
<- 7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
aqua Merge declares Lib
2+
3+
use "libSubA"
4+
use "libSubB"
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
aqua Rename declares AB
2+
3+
use LibA as A, LibB as B from "libAB" as AB
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
aqua Lib.Sub.A declares f
2+
3+
func f() -> i32:
4+
<- 42
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
aqua Lib.Sub.B declares g
2+
3+
func g() -> i32:
4+
<- 24
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
aqua Main
2+
3+
use "libMerge" as M
4+
use "libRename" as R
5+
use "libExport"
6+
7+
export merged
8+
export renamed
9+
export Export.Me.Please.exp as exported
10+
11+
func merged() -> i32:
12+
<- M.Lib.Sub.A.f() + M.Lib.Sub.B.g()
13+
14+
func renamed() -> i32:
15+
<- R.AB.A.SubA.f() + R.AB.B.SubB.g()

integration-tests/src/__test__/examples.spec.ts

+16
Original file line numberDiff line numberDiff line change
@@ -212,6 +212,7 @@ import { yesNoStreamCall } from "../examples/recursiveStreams/yesNoStreamCall.js
212212
import { multiRecStreamCall } from "../examples/recursiveStreams/multiRecStreamCall.js";
213213
import { pipelineStreamCall } from "../examples/recursiveStreams/pipelineCall.js";
214214
import { remoteRecStreamCall } from "../examples/recursiveStreams/remoteRecCall.js";
215+
import { renamedCall, mergedCall, exportedCall } from "../examples/modules.js";
215216

216217
var selfPeerId: string;
217218
var peer1: IFluenceClient;
@@ -1318,4 +1319,19 @@ describe("Testing examples", () => {
13181319
const joinCallResult = await joinIdxCall(relayPeerId1);
13191320
expect(joinCallResult.length).toBeGreaterThanOrEqual(2);
13201321
}, 10000);
1322+
1323+
it("modules/main.aqua merged", async () => {
1324+
const result = await mergedCall();
1325+
expect(result).toBe(66);
1326+
});
1327+
1328+
it("modules/main.aqua renamed", async () => {
1329+
const result = await renamedCall();
1330+
expect(result).toBe(110);
1331+
});
1332+
1333+
it("modules/main.aqua exported", async () => {
1334+
const result = await exportedCall();
1335+
expect(result).toBe(7);
1336+
});
13211337
});
+31
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
/*
2+
* Copyright (C) 2024 Fluence DAO
3+
*
4+
* This program is free software: you can redistribute it and/or modify
5+
* it under the terms of the GNU Affero General Public License as
6+
* published by the Free Software Foundation, version 3.
7+
*
8+
* This program is distributed in the hope that it will be useful,
9+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
10+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11+
* GNU Affero General Public License for more details.
12+
*
13+
* You should have received a copy of the GNU Affero General Public License
14+
* along with this program. If not, see <http://www.gnu.org/licenses/>.
15+
*/
16+
17+
import {
18+
renamed, merged, exported
19+
} from "../compiled/examples/imports_exports/modules/main.js";
20+
21+
export async function renamedCall(): Promise<number> {
22+
return await renamed();
23+
}
24+
25+
export async function mergedCall(): Promise<number> {
26+
return await merged();
27+
}
28+
29+
export async function exportedCall(): Promise<number> {
30+
return await exported();
31+
}

0 commit comments

Comments
 (0)