Skip to content

Commit

Permalink
add tests for import
Browse files Browse the repository at this point in the history
  • Loading branch information
hidetatz committed Jul 30, 2023
1 parent c67a3dc commit 9cae5f2
Show file tree
Hide file tree
Showing 5 changed files with 42 additions and 0 deletions.
15 changes: 15 additions & 0 deletions tests/imp.sb
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import imp_2

v = 1

def f() {
return 2
}

def g() {
return imp_2.v
}

def h() {
return imp_2.h()
}
7 changes: 7 additions & 0 deletions tests/imp_2.sb
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import imp_sub/imp_3

v = 3

def h() {
return imp_3.h()
}
1 change: 1 addition & 0 deletions tests/imp_4.sb
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
v = 4
5 changes: 5 additions & 0 deletions tests/imp_sub/imp_3.sb
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import ../imp_4

def h() {
return imp_4.v
}
14 changes: 14 additions & 0 deletions tests/import.sb
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import assert

as = assert.assert

v = 100

import imp

as(1, imp.v)
as(2, imp.f())
as(3, imp.g())
as(4, imp.h())

print("import test succeeded")

0 comments on commit 9cae5f2

Please sign in to comment.