tests: add submodules tests (#9640)

pull/9862/head
Carlos Esquerdo Bernat 2021-04-23 16:22:24 +02:00 committed by GitHub
parent b2dc444dd2
commit 42a65e1009
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 51 additions and 0 deletions

View File

@ -0,0 +1,10 @@
module submodules
pub struct Main {
pub:
a string
}
fn init() {
println('init submodules')
}

View File

@ -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
}

View File

@ -0,0 +1,10 @@
module test
pub struct Test {
pub:
a string
}
fn init() {
println('init submodules.test')
}

View File

@ -0,0 +1,10 @@
module test2
pub struct Test2 {
pub:
a string
}
fn init() {
println('init submodules.test.test2')
}