Skip to content
This repository has been archived by the owner on Feb 3, 2021. It is now read-only.

Commit

Permalink
Browse files Browse the repository at this point in the history
* Add PUGS_USE_EXTERNAL_TEST env variable that uses external Test.pm.
  So this works now:

     PUGS_USE_EXTERNAL_TEST=1 dist/build/pugs/pugs -Iext/Test/lib -MTest -e 'done_testing'

  To cache compilation AST, do this:

     dist/build/pugs/pugs -CParse-Yaml ext/Test/lib/Test.pm  > ext/Test/lib/Test.pm.yml
  • Loading branch information
audreyt committed Feb 18, 2012
1 parent 36d2ba8 commit d62568e
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions Pugs/src/Pugs/Prim/Eval.hs
Expand Up @@ -52,8 +52,9 @@ opRequire dumpEnv v = do
loaded <- existsFromRef seen v
let file | '.' `elem` mod = mod
| otherwise = (concat $ intersperse (getConfig "file_sep") $ split "::" mod) ++ ".pm"
useExternalTest <- io $ (maybe False (/= "")) `fmap` (getEnv "PUGS_USE_EXTERNAL_TEST")
pathName <- case mod of
"Test" -> return "Test.pm"
"Test" | not useExternalTest -> return "Test.pm"
_ -> requireInc incs file (errMsg file incs)
if loaded then opEval style pathName "" else do
-- %*INC{mod} = { relname => file, pathname => pathName }
Expand All @@ -70,7 +71,7 @@ opRequire dumpEnv v = do
ends <- fromVal =<< readRef endAV
clearRef endAV
rv <- case mod of
"Test" -> shortcutToTestPM
"Test" | not useExternalTest -> shortcutToTestPM
_ -> tryFastEval pathName (pathName ++ ".yml")
endAV' <- findSymRef (cast "@*END") glob
_ <- doArray (VRef endAV') (`array_unshift` ends)
Expand All @@ -88,7 +89,7 @@ opRequire dumpEnv v = do
evl <- asks envEval
evl ast
tryFastEval pathName pathNameYml = do
io $ print pathNameYml
-- io $ print pathNameYml
ok <- io $ doesFileExist pathNameYml
if not ok then slowEval pathName else do
isYamlStale <- tryIO False $ do
Expand Down

0 comments on commit d62568e

Please sign in to comment.