Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions test/Language/PureScript/Backend/Lua/Golden/Spec.hs
Original file line number Diff line number Diff line change
Expand Up @@ -75,10 +75,10 @@ spec ∷ Spec
spec = do
describe "Goldens: *.purs -> *.lua" do
let compilePs = do
putText "Comipling PureScript sources"
putText "Compiling PureScript sources"
exitCode ←
runProcess . setWorkingDir "test/ps" . shell $
String.unwords ["spago", "build", "-u", "'-g corefn'"]
String.unwords ["spago", "build"]
exitCode `shouldBe` ExitSuccess
psOutputPath = $(mkRelDir "test/ps/output/")

Expand Down
16 changes: 16 additions & 0 deletions test/ps/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
/output/*/*.json
!/output/Golden*/corefn.json
/output/*/*.js
/output/*/*.js.map
/output/*/actual.*
/output/*.json
/output-es/
Expand All @@ -14,3 +15,18 @@
/.purs*
/.psa*
/.spago

# Spago build artifacts (library dependencies)
# Only Golden.* test directories should be tracked
/output/Control.*/
/output/Data.*/
/output/Effect*/
/output/Prelude/
/output/Record.*/
/output/Safe.*/
/output/Spago.*/
/output/Type.*/
/output/Unsafe.*/

# Spago lock file (regenerated on build)
/spago.lock
4 changes: 0 additions & 4 deletions test/ps/output/Golden.ArrayOfUnits.Test/eval/golden.txt

This file was deleted.

12 changes: 6 additions & 6 deletions test/ps/output/Golden.ArrayOfUnits.Test/golden.ir
Original file line number Diff line number Diff line change
Expand Up @@ -4,25 +4,25 @@ UberModule
( QName
{ qnameModuleName = ModuleName "Data.Unit", qnameName = Name "foreign"
}, ForeignImport Nothing
( ModuleName "Data.Unit" ) ".spago/prelude/v7.2.0/src/Data/Unit.purs"
( ModuleName "Data.Unit" ) ".spago/p/prelude/384b74cec7d51a2fa20baad3768cf00575aedf63/src/Data/Unit.purs"
[ ( Just Always, Name "unit" ) ]
), Standalone
( QName
{ qnameModuleName = ModuleName "Data.Semiring", qnameName = Name "foreign"
}, ForeignImport Nothing
( ModuleName "Data.Semiring" ) ".spago/prelude/v7.2.0/src/Data/Semiring.purs"
( ModuleName "Data.Semiring" ) ".spago/p/prelude/384b74cec7d51a2fa20baad3768cf00575aedf63/src/Data/Semiring.purs"
[ ( Nothing, Name "intAdd" ), ( Nothing, Name "intMul" ) ]
), Standalone
( QName
{ qnameModuleName = ModuleName "Data.Foldable", qnameName = Name "foreign"
}, ForeignImport Nothing
( ModuleName "Data.Foldable" ) ".spago/foldable-traversable/v6.1.0/src/Data/Foldable.purs"
( ModuleName "Data.Foldable" ) ".spago/p/foldable-traversable/18a7d55fa2e87d3f2c557e24f89e197bd30c4f25/src/Data/Foldable.purs"
[ ( Nothing, Name "foldrArray" ), ( Nothing, Name "foldlArray" ) ]
), Standalone
( QName
{ qnameModuleName = ModuleName "Effect", qnameName = Name "foreign"
}, ForeignImport Nothing
( ModuleName "Effect" ) ".spago/effect/v4.1.0/src/Effect.purs"
( ModuleName "Effect" ) ".spago/p/effect/ee3f5984b9d68c3e116eeb44da09dcb8714c9c66/src/Effect.purs"
[ ( Nothing, Name "pureE" ), ( Nothing, Name "bindE" ) ]
), Standalone
( QName
Expand Down Expand Up @@ -339,7 +339,7 @@ UberModule
( App Nothing
( ObjectProp ( Just Always )
( ForeignImport Nothing
( ModuleName "Effect.Console" ) ".spago/console/v6.1.0/src/Effect/Console.purs"
( ModuleName "Effect.Console" ) ".spago/p/console/66f1ba20176dd9b35aff47b45f13fd17582683b1/src/Effect/Console.purs"
[ ( Nothing, Name "log" ) ]
)
( PropName "log" )
Expand Down Expand Up @@ -520,7 +520,7 @@ UberModule
[
( PropName "show", ObjectProp ( Just Always )
( ForeignImport Nothing
( ModuleName "Data.Show" ) ".spago/prelude/v7.2.0/src/Data/Show.purs"
( ModuleName "Data.Show" ) ".spago/p/prelude/384b74cec7d51a2fa20baad3768cf00575aedf63/src/Data/Show.purs"
[ ( Nothing, Name "showIntImpl" ) ]
)
( PropName "showIntImpl" )
Expand Down
48 changes: 25 additions & 23 deletions test/ps/output/Golden.ArrayOfUnits.Test/golden.lua
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ local function PSLUA_runtime_lazy(name)
end
end
local M = {}
M.Data_Unit_foreign = { unit = {} }
M.Data_Unit_foreign = { unit = nil }
M.Data_Semiring_foreign = {
intAdd = function(x) return function(y) return x + y end end,
intMul = function(x) return function(y) return x * y end end
Expand Down Expand Up @@ -127,25 +127,27 @@ M.Effect_Console_logShow = function(dictShow)
return (function(s) return function() print(s) end end)(dictShow.show(a))
end
end
return (function()
local arr = {
[1] = M.Data_Unit_foreign.unit,
[2] = M.Data_Unit_foreign.unit,
[3] = M.Data_Unit_foreign.unit
}
return M.Control_Bind_bind(M.Effect_bindEffect)(M.Data_Foldable_foldr(M.Data_Foldable_foldableArray)(M.Control_Semigroupoid_semigroupoidFn.compose(function( a )
return M.Control_Apply_apply(M.Effect_applicativeEffect.Apply0())(((M.Effect_applicativeEffect.Apply0()).Functor0()).map(function( )
return function(x) return x end
end)(a))
end)(M.Effect_Console_logShow({
show = function() return "unit" end
})))(M.Control_Applicative_pure(M.Effect_applicativeEffect)(M.Data_Unit_foreign.unit))(arr))(function( )
return M.Effect_Console_logShow({
show = function(n) return tostring(n) end
})(M.Data_Foldable_foldableArray.foldl(function(c)
return function()
return M.Data_Semiring_semiringInt.add(M.Data_Semiring_semiringInt.one)(c)
end
end)(M.Data_Semiring_semiringInt.zero)(arr))
end)
end)()()
return {
main = (function()
local arr = {
[1] = M.Data_Unit_foreign.unit,
[2] = M.Data_Unit_foreign.unit,
[3] = M.Data_Unit_foreign.unit
}
return M.Control_Bind_bind(M.Effect_bindEffect)(M.Data_Foldable_foldr(M.Data_Foldable_foldableArray)(M.Control_Semigroupoid_semigroupoidFn.compose(function( a )
return M.Control_Apply_apply(M.Effect_applicativeEffect.Apply0())(((M.Effect_applicativeEffect.Apply0()).Functor0()).map(function( )
return function(x) return x end
end)(a))
end)(M.Effect_Console_logShow({
show = function() return "unit" end
})))(M.Control_Applicative_pure(M.Effect_applicativeEffect)(M.Data_Unit_foreign.unit))(arr))(function( )
return M.Effect_Console_logShow({
show = function(n) return tostring(n) end
})(M.Data_Foldable_foldableArray.foldl(function(c)
return function()
return M.Data_Semiring_semiringInt.add(M.Data_Semiring_semiringInt.one)(c)
end
end)(M.Data_Semiring_semiringInt.zero)(arr))
end)
end)()
}
1 change: 0 additions & 1 deletion test/ps/output/Golden.Fibonacci.Test/eval/golden.txt

This file was deleted.

8 changes: 4 additions & 4 deletions test/ps/output/Golden.Fibonacci.Test/golden.ir
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ UberModule
( QName
{ qnameModuleName = ModuleName "Data.Semiring", qnameName = Name "foreign"
}, ForeignImport Nothing
( ModuleName "Data.Semiring" ) ".spago/prelude/v7.2.0/src/Data/Semiring.purs"
( ModuleName "Data.Semiring" ) ".spago/p/prelude/384b74cec7d51a2fa20baad3768cf00575aedf63/src/Data/Semiring.purs"
[ ( Nothing, Name "intAdd" ), ( Nothing, Name "intMul" ) ]
), Standalone
( QName
Expand All @@ -30,7 +30,7 @@ UberModule
[
( PropName "sub", ObjectProp ( Just Always )
( ForeignImport Nothing
( ModuleName "Data.Ring" ) ".spago/prelude/v7.2.0/src/Data/Ring.purs"
( ModuleName "Data.Ring" ) ".spago/p/prelude/384b74cec7d51a2fa20baad3768cf00575aedf63/src/Data/Ring.purs"
[ ( Nothing, Name "intSub" ) ]
)
( PropName "intSub" )
Expand Down Expand Up @@ -103,7 +103,7 @@ UberModule
( Name "main", App Nothing
( ObjectProp ( Just Always )
( ForeignImport Nothing
( ModuleName "Effect.Console" ) ".spago/console/v6.1.0/src/Effect/Console.purs"
( ModuleName "Effect.Console" ) ".spago/p/console/66f1ba20176dd9b35aff47b45f13fd17582683b1/src/Effect/Console.purs"
[ ( Nothing, Name "log" ) ]
)
( PropName "log" )
Expand All @@ -114,7 +114,7 @@ UberModule
[
( PropName "show", ObjectProp ( Just Always )
( ForeignImport Nothing
( ModuleName "Data.Show" ) ".spago/prelude/v7.2.0/src/Data/Show.purs"
( ModuleName "Data.Show" ) ".spago/p/prelude/384b74cec7d51a2fa20baad3768cf00575aedf63/src/Data/Show.purs"
[ ( Nothing, Name "showIntImpl" ) ]
)
( PropName "showIntImpl" )
Expand Down
5 changes: 4 additions & 1 deletion test/ps/output/Golden.Fibonacci.Test/golden.lua
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,7 @@ M.Golden_Fibonacci_Test_fib = function(v)
end
end
end
return (function(s) return function() print(s) end end)((function(n) return tostring(n) end)(M.Golden_Fibonacci_Test_fib(32)))()
return {
fib = M.Golden_Fibonacci_Test_fib,
main = (function(s) return function() print(s) end end)((function(n) return tostring(n) end)(M.Golden_Fibonacci_Test_fib(32)))
}
4 changes: 2 additions & 2 deletions test/ps/output/Golden.HelloPrelude.Test/golden.ir
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ UberModule
( QName
{ qnameModuleName = ModuleName "Effect", qnameName = Name "foreign"
}, ForeignImport Nothing
( ModuleName "Effect" ) ".spago/effect/v4.1.0/src/Effect.purs"
( ModuleName "Effect" ) ".spago/p/effect/ee3f5984b9d68c3e116eeb44da09dcb8714c9c66/src/Effect.purs"
[ ( Nothing, Name "pureE" ), ( Nothing, Name "bindE" ) ]
), Standalone
( QName
Expand Down Expand Up @@ -206,7 +206,7 @@ UberModule
)
( ObjectProp ( Just Always )
( ForeignImport Nothing
( ModuleName "Data.Unit" ) ".spago/prelude/v7.2.0/src/Data/Unit.purs"
( ModuleName "Data.Unit" ) ".spago/p/prelude/384b74cec7d51a2fa20baad3768cf00575aedf63/src/Data/Unit.purs"
[ ( Just Always, Name "unit" ) ]
)
( PropName "unit" )
Expand Down
2 changes: 1 addition & 1 deletion test/ps/output/Golden.HelloPrelude.Test/golden.lua
Original file line number Diff line number Diff line change
Expand Up @@ -70,4 +70,4 @@ M.Effect_Lazy_applyEffect = PSLUA_runtime_lazy("applyEffect")(function()
Functor0 = function() return M.Effect_Lazy_functorEffect(0) end
}
end)
return { main = M.Control_Applicative_pure(M.Effect_applicativeEffect)({}) }
return { main = M.Control_Applicative_pure(M.Effect_applicativeEffect)(nil) }
Loading