Added test case for grabbing a module from /usr/include/fspl

This commit is contained in:
Sasha Koshka 2024-02-26 14:33:31 -05:00
parent aa3cabe82b
commit 496d4aeb01
7 changed files with 21 additions and 5 deletions

View File

@ -7,6 +7,7 @@ import "testing"
import "os/exec"
import "path/filepath"
import "git.tebibyte.media/fspl/fspl/entity"
import "git.tebibyte.media/fspl/fspl/errors"
import "git.tebibyte.media/fspl/fspl/testcommon"
//go:embed all:test-data/*
@ -32,10 +33,10 @@ func testUnit (
comp.Writer = compOutputBuilder
comp.Prefix = "compiler"
comp.Resolver = NewResolver (
"/usr/local/src/fspl",
"/usr/src/fspl",
"/usr/local/incude/fspl",
"/usr/include/fspl")
"/test-data/usr/local/src/fspl",
"/test-data/usr/src/fspl",
"/test-data/usr/local/incude/fspl",
"/test-data/usr/include/fspl")
comp.Resolver.FS = testData
comp.Output = filepath.Join(temp, "output.o")
comp.Format = ".o"
@ -44,7 +45,7 @@ func testUnit (
// compile to object file
err := comp.CompileUnit(address)
if err != nil {
test.Error("compiler returned error:", err)
test.Error("compiler returned error:", errors.Format(err))
return
}

View File

@ -15,3 +15,10 @@ testUnit (test,
"", "",
13,
)}
func TestSystemInclude (test *testing.T) {
testUnit (test,
"/test-data/data/systeminclude", nil,
"", "Hello, /usr/include!",
0,
)}

View File

@ -0,0 +1,2 @@
'15059679-90a0-468a-be57-62f8b958d46b'
+ 'cstdio'

View File

@ -0,0 +1,4 @@
[main]: I32 = {
cstdio::[puts 'Hello, /usr/include!']
0
}

View File

@ -0,0 +1 @@
'f95aaa14-612c-45cd-b3ae-fd24049cc81b'

View File

@ -0,0 +1 @@
+ [puts string:*Byte]: Index 'puts'