fun test_cmd_http_entity is test do
var req = new_request("/test_prog::Character")
- var cmd = new CmdEntity(test_view)
+ var cmd = new CmdEntity(test_model)
var res = cmd.http_init(req)
assert res isa CmdSuccess
assert cmd.mentity.as(not null).full_name == "test_prog::Character"
end
fun test_cmd_http_entity_not_found is test do
- var req = new_request("/Characterzzz")
- var cmd = new CmdEntity(test_view)
+ var req = new_request("/Characterz")
+ var cmd = new CmdEntity(test_model)
var res = cmd.http_init(req)
assert res isa ErrorMEntityNotFound
assert res.suggestions.first.full_name == "test_prog::Character"
fun test_cmd_http_entity_conflict is test do
var req = new_request("/+")
- var cmd = new CmdEntity(test_view)
+ var cmd = new CmdEntity(test_model)
var res = cmd.http_init(req)
assert res isa ErrorMEntityConflict
assert res.conflicts.length == 2
fun test_cmd_http_comment is test do
var req = new_request("/test_prog::Character")
- var cmd = new CmdComment(test_view)
+ var cmd = new CmdComment(test_model)
var res = cmd.http_init(req)
assert res isa CmdSuccess
assert cmd.mdoc != null
fun test_cmd_http_comment_no_mdoc is test do
var req = new_request("/test_prog::Character?fallback=false")
- var cmd = new CmdComment(test_view)
+ var cmd = new CmdComment(test_model)
var res = cmd.http_init(req)
assert res isa WarningNoMDoc
end
+ # CmdEntityLink
+
+ fun test_cmd_http_link is test do
+ var req = new_request("/test_prog::Character")
+ var cmd = new CmdEntityLink(test_model)
+ var res = cmd.http_init(req)
+ assert res isa CmdSuccess
+ assert cmd.text == "Character"
+ assert cmd.title == "Characters can be played by both the human or the machine."
+ end
+
+ fun test_cmd_http_link_with_text is test do
+ var req = new_request("/test_prog::Character?text=foo")
+ var cmd = new CmdEntityLink(test_model)
+ var res = cmd.http_init(req)
+ assert res isa CmdSuccess
+ assert cmd.text == "foo"
+ assert cmd.title == "Characters can be played by both the human or the machine."
+ end
+
+ fun test_cmd_http_link_with_title is test do
+ var req = new_request("/test_prog::Character?title=bar")
+ var cmd = new CmdEntityLink(test_model)
+ var res = cmd.http_init(req)
+ assert res isa CmdSuccess
+ assert cmd.text == "Character"
+ assert cmd.title == "bar"
+ end
+
+ fun test_cmd_http_link_with_text_and_title is test do
+ var req = new_request("/test_prog::Character?text=foo&title=bar")
+ var cmd = new CmdEntityLink(test_model)
+ var res = cmd.http_init(req)
+ assert res isa CmdSuccess
+ assert cmd.text == "foo"
+ assert cmd.title == "bar"
+ end
+
# CmdInheritance
fun test_cmd_http_parents is test do
var req = new_request("/test_prog::Warrior")
- var cmd = new CmdParents(test_view)
+ var cmd = new CmdParents(test_model, test_main)
var res = cmd.http_init(req)
assert res isa CmdSuccess
assert cmd.results.as(not null).length == 1
fun test_cmd_http_ancestors is test do
var req = new_request("/test_prog::Warrior")
- var cmd = new CmdAncestors(test_view)
+ var cmd = new CmdAncestors(test_model, test_main)
var res = cmd.http_init(req)
assert res isa CmdSuccess
assert cmd.results.as(not null).length == 2
fun test_cmd_http_ancestorsi_without_parents is test do
var req = new_request("/test_prog::Warrior?parents=false")
- var cmd = new CmdAncestors(test_view)
+ var cmd = new CmdAncestors(test_model, test_main)
var res = cmd.http_init(req)
assert res isa CmdSuccess
assert cmd.results.as(not null).length == 1
fun test_cmd_http_children is test do
var req = new_request("/test_prog::Career")
- var cmd = new CmdChildren(test_view)
+ var cmd = new CmdChildren(test_model, test_main)
var res = cmd.http_init(req)
assert res isa CmdSuccess
assert cmd.results.as(not null).length == 3
fun test_cmd_http_descendants is test do
var req = new_request("/test_prog::Career?children=false")
- var cmd = new CmdDescendants(test_view)
+ var cmd = new CmdDescendants(test_model, test_main)
var res = cmd.http_init(req)
assert res isa CmdSuccess
assert cmd.results.as(not null).length == 0
end
+ fun test_cmd_http_ancestors_with_filter_match is test do
+ var req = new_request("/test_prog::Warrior?match=Object")
+ var cmd = new CmdAncestors(test_model, test_main)
+ var res = cmd.http_init(req)
+ assert res isa CmdSuccess
+ assert cmd.results.as(not null).length == 1
+ end
+
# CmdSearch
fun test_cmd_http_search is test do
var req = new_request("/?q=Carer&l=1")
- var cmd = new CmdSearch(test_view)
+ var cmd = new CmdSearch(test_model)
var res = cmd.http_init(req)
assert res isa CmdSuccess
assert cmd.results.as(not null).first.full_name == "test_prog::Career"
fun test_cmd_http_search_no_query is test do
var req = new_request("/")
- var cmd = new CmdSearch(test_view)
+ var cmd = new CmdSearch(test_model)
var res = cmd.http_init(req)
assert res isa ErrorNoQuery
end
fun test_cmd_http_features is test do
var req = new_request("/test_prog::Character?l=10")
- var cmd = new CmdFeatures(test_view)
+ var cmd = new CmdFeatures(test_model)
var res = cmd.http_init(req)
assert res isa CmdSuccess
assert cmd.results.as(not null).length == 10
fun test_cmd_http_features_no_features is test do
var req = new_request("/test_prog$Career$strength_bonus?l=10")
- var cmd = new CmdFeatures(test_view)
+ var cmd = new CmdFeatures(test_model)
var res = cmd.http_init(req)
assert res isa WarningNoFeatures
end
+ fun test_cmd_http_features_with_filter_inherited is test do
+ var req = new_request("/test_prog::TestGame?inherited=TestGame")
+ var cmd = new CmdFeatures(test_model)
+ var res = cmd.http_init(req)
+ assert res isa CmdSuccess
+ assert cmd.results.as(not null).length == 4
+ end
+
# CmdLinearization
fun test_cmd_http_lin is test do
var req = new_request("/init?l=10")
- var cmd = new CmdLinearization(test_view)
+ var cmd = new CmdLinearization(test_model, test_main)
var res = cmd.http_init(req)
assert res isa CmdSuccess
- assert cmd.results.as(not null).length == 10
+ assert cmd.results.as(not null).length == 9
end
fun test_cmd_http_lin_no_lin is test do
var req = new_request("/test_prog?l=10")
- var cmd = new CmdLinearization(test_view)
+ var cmd = new CmdLinearization(test_model, test_main)
var res = cmd.http_init(req)
assert res isa WarningNoLinearization
end
fun test_cmd_http_code is test do
var req = new_request("/test_prog::Career")
- var cmd = new CmdEntityCode(test_view, test_builder)
+ var cmd = new CmdEntityCode(test_model, test_builder)
var res = cmd.http_init(req)
assert res isa CmdSuccess
assert cmd.node isa AStdClassdef
fun test_cmd_http_code_format is test do
var req = new_request("/test_prog::Career?format=html")
- var cmd = new CmdEntityCode(test_view, test_builder)
+ var cmd = new CmdEntityCode(test_model, test_builder)
var res = cmd.http_init(req)
assert res isa CmdSuccess
assert cmd.node isa AStdClassdef
fun test_cmd_http_code_no_code is test do
var req = new_request("/test_prog")
- var cmd = new CmdEntityCode(test_view, test_builder)
+ var cmd = new CmdEntityCode(test_model, test_builder)
var res = cmd.http_init(req)
assert res isa WarningNoCode
end
fun test_cmd_http_results is test do
var req = new_request("/?kind=modules&l=2")
- var cmd = new CmdModelEntities(test_view, kind = "modules")
+ var cmd = new CmdModelEntities(test_model, kind = "modules")
var res = cmd.http_init(req)
assert res isa CmdSuccess
assert cmd.results.as(not null).length == 2
fun test_cmd_http_results_random is test do
var req = new_request("/?kind=packages&l=1")
- var cmd = new CmdRandomEntities(test_view, kind = "packages")
+ var cmd = new CmdRandomEntities(test_model, kind = "packages")
var res = cmd.http_init(req)
assert res isa CmdSuccess
assert cmd.results.as(not null).length == 1
fun test_cmd_http_uml is test do
var req = new_request("/test_prog::Character?format=svg")
- var cmd = new CmdUML(test_view)
+ var cmd = new CmdUML(test_model, test_main)
var res = cmd.http_init(req)
assert res isa CmdSuccess
assert cmd.uml != null
fun test_cmd_http_uml_not_found is test do
var req = new_request("/strength_bonus")
- var cmd = new CmdUML(test_view)
+ var cmd = new CmdUML(test_model, test_main)
var res = cmd.http_init(req)
assert res isa WarningNoUML
assert cmd.format == "dot"
fun test_cmd_http_inh_graph is test do
var req = new_request("/test_prog::Character?pdepth=1&cdepth=1")
- var cmd = new CmdInheritanceGraph(test_view)
+ var cmd = new CmdInheritanceGraph(test_model, test_main)
var res = cmd.http_init(req)
assert res isa CmdSuccess
assert cmd.graph != null
# CmdCatalog
fun test_cmd_http_catalog_search is test do
- var req = new_request("/?q=test&l=1")
- var cmd = new CmdCatalogSearch(test_view, test_catalog)
+ var req = new_request("/?q=testprog&l=1")
+ var cmd = new CmdCatalogSearch(test_model, test_catalog)
var res = cmd.http_init(req)
assert res isa CmdSuccess
assert cmd.results.as(not null).first.full_name == "test_prog"
fun test_cmd_http_catalog_tag is test do
var req = new_request("/test", "/:tid")
- var cmd = new CmdCatalogTag(test_view, test_catalog)
+ var cmd = new CmdCatalogTag(test_model, test_catalog)
var res = cmd.http_init(req)
assert res isa CmdSuccess
assert cmd.tag == "test"
fun test_cmd_http_catalog_person is test do
var req = new_request("/Alexandre%20Terrasa", "/:pid")
- var cmd = new CmdCatalogPerson(test_view, test_catalog)
+ var cmd = new CmdCatalogPerson(test_model, test_catalog)
var res = cmd.http_init(req)
assert res isa CmdSuccess
assert cmd.person.as(not null).name == "Alexandre Terrasa"