lang: Pass through the Fs and the FsURI

This should give us options as to how a function should interact with an
FS. I feel like it's cleaner to go through the World API, and passing in
the FsURI lets us do that, but I passed in the Fs at the same time in
case it's useful for some reason. I think using it is a boundary
violation, but it's just a hunch. Does anything break when we move from
one deploy to the next?
This commit is contained in:
James Shubin
2019-07-23 01:26:00 -04:00
parent 4b6b91c08b
commit 066048f4de
8 changed files with 47 additions and 9 deletions

View File

@@ -441,6 +441,7 @@ func TestAstFunc0(t *testing.T) {
t.Logf("test #%d: AST: %+v", index, ast)
data := &interfaces.Data{
// TODO: add missing fields here if/when needed
Debug: testing.Verbose(), // set via the -test.v flag to `go test`
Logf: func(format string, v ...interface{}) {
t.Logf("ast: "+format, v...)
@@ -790,7 +791,9 @@ func TestAstFunc1(t *testing.T) {
importGraph.AddVertex(importVertex)
data := &interfaces.Data{
// TODO: add missing fields here if/when needed
Fs: fs,
FsURI: fs.URI(), // TODO: is this right?
Base: output.Base, // base dir (absolute path) the metadata file is in
Files: output.Files, // no really needed here afaict
Imports: importVertex,
@@ -1232,9 +1235,11 @@ func TestAstFunc2(t *testing.T) {
importGraph.AddVertex(importVertex)
data := &interfaces.Data{
// TODO: add missing fields here if/when needed
Fs: fs,
Base: output.Base, // base dir (absolute path) the metadata file is in
Files: output.Files, // no really needed here afaict
FsURI: "memmapfs:///", // we're in standalone mode
Base: output.Base, // base dir (absolute path) the metadata file is in
Files: output.Files, // no really needed here afaict
Imports: importVertex,
Metadata: output.Metadata,
Modules: "/" + interfaces.ModuleDirectory, // not really needed here afaict
@@ -1676,6 +1681,7 @@ func TestAstInterpret0(t *testing.T) {
t.Logf("test #%d: AST: %+v", index, ast)
data := &interfaces.Data{
// TODO: add missing fields here if/when needed
Debug: testing.Verbose(), // set via the -test.v flag to `go test`
Logf: func(format string, v ...interface{}) {
t.Logf("ast: "+format, v...)