git.iko.soy/rowtype-yoga/purescm
on bytevector help sign in
Use lib.ss and pass libdirs
commit86bc43bda90ef6d6a6a74476d2eff4db51da5425 authorpurefunctor <purefunctor@pm.me> dateMon 20 Mar 2023, 22:06 (4 years ago) parentb497fba
3 files changed+11−6
test-snapshots/snapshots-input/Snapshot.Import.Impl.ss+5 test/Main.purs+3−3 test/Utils.purs+3−3
test-snapshots/snapshots-input/Snapshot.Import.Impl.ssnew file+5
@@ -0,0 +1,5 @@
1+(library (Snapshot.Import.Impl foreign)
2+ (export addImpl)
3+ (import (chezscheme))
4+
5+ (define addImpl (lambda (x) (lambda (y) (+ x y)))))
test/Main.purs+3−3
@@ -112,7 +112,7 @@ runSnapshotTests { accept, filter } = do
112112 $ S.printLibrary
113113 $ codegenModule backend
114114 let testFileDir = Path.concat [ testOut, name ]
115− let testFilePath = Path.concat [ testFileDir, "output.ss" ]
115+ let testFilePath = Path.concat [ testFileDir, "lib.ss" ]
116116 mkdirp testFileDir
117117 FS.writeTextFile UTF8 testFilePath formatted
118118 unless (Set.isEmpty backend.foreign) do
@@ -141,8 +141,8 @@ runSnapshotTests { accept, filter } = do
141141 let
142142 snapshotFilePath = Path.concat [ snapshotsOut, name <> ".ss" ]
143143 runAcceptedTest = do
144− schemeFile <- liftEffect $ Path.resolve [ testOut, name ] "output.ss"
145− result <- loadModuleMain schemeBin hasMain schemeFile
144+ schemeFile <- liftEffect $ Path.resolve [ testOut, name ] "lib.ss"
145+ result <- loadModuleMain testOut schemeBin hasMain schemeFile
146146 case result of
147147 Left err | matchesFail err.message failsWith -> do
148148 Console.log $ withGraphics (foreground Red) "✗" <> " " <> name <> " failed."
test/Utils.purs+3−3
@@ -76,11 +76,11 @@ mkdirp :: FilePath -> Aff Unit
7676mkdirp path = FS.mkdir' path { recursive: true, mode: mkPerms Perms.all Perms.all Perms.all }
7777
7878-- | Note: this code needs to be updated to run Chez Scheme scripts
79−loadModuleMain :: String -> Boolean -> FilePath -> Aff (Either ExecaError ExecaSuccess)
80−loadModuleMain schemeBin hasMain path = do
79+loadModuleMain :: FilePath -> String -> Boolean -> FilePath -> Aff (Either ExecaError ExecaSuccess)
80+loadModuleMain libDir schemeBin hasMain path = do
8181 when hasMain do
8282 liftEffect $ log "Running a snaphot as a top-level program is not yet implemented."
83− spawned <- execa schemeBin [ "--script", path ] identity
83+ spawned <- execa schemeBin [ "--libdirs", libDir <> ":", "--script", path ] identity
8484 spawned.result
8585
8686copyFile :: FilePath -> FilePath -> Aff Unit