nitlanguage
/
nit.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Added setup files.
[nit.git]
/
src
/
nitunit.nit
diff --git
a/src/nitunit.nit
b/src/nitunit.nit
index
acb6c1c
..
e2404ca
100644
(file)
--- a/
src/nitunit.nit
+++ b/
src/nitunit.nit
@@
-23,8
+23,8
@@
import parser_util
class NitUnitExecutor
super Doc2Mdwn
class NitUnitExecutor
super Doc2Mdwn
- # The name of the module to import
- var modname: String
+ # The module to import
+ var mmodule: MModule
# The prefix of the generated Nit source-file
var prefix: String
# The prefix of the generated Nit source-file
var prefix: String
@@
-33,11
+33,11
@@
class NitUnitExecutor
var testsuite: HTMLTag
# Initialize a new e
var testsuite: HTMLTag
# Initialize a new e
- init(toolcontext: ToolContext, prefix: String, modname: String, testsuite: HTMLTag)
+ init(toolcontext: ToolContext, prefix: String, mmodule: MModule, testsuite: HTMLTag)
do
super(toolcontext)
self.prefix = prefix
do
super(toolcontext)
self.prefix = prefix
- self.modname = modname
+ self.mmodule = mmodule
self.testsuite = testsuite
end
self.testsuite = testsuite
end
@@
-110,7
+110,7
@@
class NitUnitExecutor
cpt += 1
var file = "{prefix}{cpt}.nit"
cpt += 1
var file = "{prefix}{cpt}.nit"
- toolcontext.info("Execute {tc.attrs["classname"]}.{tc.attrs["name"]} in {file}", 1)
+ toolcontext.info("Execute {tc.attrs["name"]} in {file}", 1)
var dir = file.dirname
if dir != "" then dir.mkdir
var dir = file.dirname
if dir != "" then dir.mkdir
@@
-118,8
+118,7
@@
class NitUnitExecutor
f = new OFStream.open(file)
f.write("# GENERATED FILE\n")
f.write("# Example extracted from a documentation\n")
f = new OFStream.open(file)
f.write("# GENERATED FILE\n")
f.write("# Example extracted from a documentation\n")
- var modname = self.modname
- f.write("import {modname}\n")
+ f.write("import {mmodule.name}\n")
f.write("\n")
for text in block do
f.write(text)
f.write("\n")
for text in block do
f.write(text)
@@
-134,7
+133,7
@@
class NitUnitExecutor
toolcontext.error(null, "Cannot find nitg. Set envvar NIT_DIR.")
toolcontext.check_errors
end
toolcontext.error(null, "Cannot find nitg. Set envvar NIT_DIR.")
toolcontext.check_errors
end
- var cmd = "{nitg} --ignore-visibility --no-color '{file}' -I . >'{file}.out1' 2>&1 </dev/null -o '{file}.bin'"
+ var cmd = "{nitg} --ignore-visibility --no-color '{file}' -I {mmodule.location.file.filename.dirname} >'{file}.out1' 2>&1 </dev/null -o '{file}.bin'"
var res = sys.system(cmd)
var res2 = 0
if res == 0 then
var res = sys.system(cmd)
var res2 = 0
if res == 0 then
@@
-209,7
+208,7
@@
redef class ModelBuilder
# TODO do things correctly once the importation of arbitraty nested module is legal
var o = mmodule
var g = o.mgroup
# TODO do things correctly once the importation of arbitraty nested module is legal
var o = mmodule
var g = o.mgroup
- if g != null then
+ if g != null and g.mproject.name == "standard" then
o = get_mmodule_by_name(nmodule, g, g.mproject.name).as(not null)
end
o = get_mmodule_by_name(nmodule, g, g.mproject.name).as(not null)
end
@@
-218,7
+217,7
@@
redef class ModelBuilder
var prefix = toolcontext.opt_dir.value
if prefix == null then prefix = ".nitunit"
prefix = prefix.join_path(mmodule.to_s)
var prefix = toolcontext.opt_dir.value
if prefix == null then prefix = ".nitunit"
prefix = prefix.join_path(mmodule.to_s)
- var d2m = new NitUnitExecutor(toolcontext, prefix, o.name, ts)
+ var d2m = new NitUnitExecutor(toolcontext, prefix, o, ts)
var tc
var tc