From 42a65e100998b5acfa767380fea97ab489c21919 Mon Sep 17 00:00:00 2001 From: Carlos Esquerdo Bernat Date: Fri, 23 Apr 2021 16:22:24 +0200 Subject: [PATCH] tests: add submodules tests (#9640) --- vlib/v/tests/modules/submodules/submodules.v | 10 +++++++++ .../modules/submodules/submodules_test.v | 21 +++++++++++++++++++ vlib/v/tests/modules/submodules/test/test.v | 10 +++++++++ .../modules/submodules/test/test2/test2.v | 10 +++++++++ 4 files changed, 51 insertions(+) create mode 100644 vlib/v/tests/modules/submodules/submodules.v create mode 100644 vlib/v/tests/modules/submodules/submodules_test.v create mode 100644 vlib/v/tests/modules/submodules/test/test.v create mode 100644 vlib/v/tests/modules/submodules/test/test2/test2.v diff --git a/vlib/v/tests/modules/submodules/submodules.v b/vlib/v/tests/modules/submodules/submodules.v new file mode 100644 index 0000000000..3a55ffb829 --- /dev/null +++ b/vlib/v/tests/modules/submodules/submodules.v @@ -0,0 +1,10 @@ +module submodules + +pub struct Main { +pub: + a string +} + +fn init() { + println('init submodules') +} diff --git a/vlib/v/tests/modules/submodules/submodules_test.v b/vlib/v/tests/modules/submodules/submodules_test.v new file mode 100644 index 0000000000..db5daf3ab3 --- /dev/null +++ b/vlib/v/tests/modules/submodules/submodules_test.v @@ -0,0 +1,21 @@ +import submodules +import submodules.test +import submodules.test.test2 + +fn test_main() { + println('main') + main := submodules.Main{ + a: 'main' + } + assert 'main' == main.a + + test := test.Test{ + a: 'test' + } + assert 'test' == test.a + + test2 := test2.Test2{ + a: 'test2' + } + assert 'test2' == test2.a +} diff --git a/vlib/v/tests/modules/submodules/test/test.v b/vlib/v/tests/modules/submodules/test/test.v new file mode 100644 index 0000000000..1a4300158f --- /dev/null +++ b/vlib/v/tests/modules/submodules/test/test.v @@ -0,0 +1,10 @@ +module test + +pub struct Test { +pub: + a string +} + +fn init() { + println('init submodules.test') +} diff --git a/vlib/v/tests/modules/submodules/test/test2/test2.v b/vlib/v/tests/modules/submodules/test/test2/test2.v new file mode 100644 index 0000000000..c4eef051df --- /dev/null +++ b/vlib/v/tests/modules/submodules/test/test2/test2.v @@ -0,0 +1,10 @@ +module test2 + +pub struct Test2 { +pub: + a string +} + +fn init() { + println('init submodules.test.test2') +}