doc/commands: remove default filter from tests
[nit.git] / src / doc / commands / tests / test_commands_model.nit
index 246d882..d61bde0 100644 (file)
@@ -24,28 +24,28 @@ class TestCommandsModel
        # CmdEntity
 
        fun test_cmd_entity is test do
-               var cmd = new CmdEntity(test_view, mentity_name = "test_prog::Character")
+               var cmd = new CmdEntity(test_model, mentity_name = "test_prog::Character")
                var res = cmd.init_command
                assert res isa CmdSuccess
                assert cmd.mentity.as(not null).full_name == "test_prog::Character"
        end
 
        fun test_cmd_entity_not_found is test do
-               var cmd = new CmdEntity(test_view, mentity_name = "test_prog::Characterzz")
+               var cmd = new CmdEntity(test_model, mentity_name = "test_prog::Characterzz")
                var res = cmd.init_command
                assert res isa ErrorMEntityNotFound
                assert res.suggestions.first.full_name == "test_prog::Character"
        end
 
        fun test_cmd_entity_conflict is test do
-               var cmd = new CmdEntity(test_view, mentity_name = "+")
+               var cmd = new CmdEntity(test_model, mentity_name = "+")
                var res = cmd.init_command
                assert res isa ErrorMEntityConflict
                assert res.conflicts.length == 2
        end
 
        fun test_cmd_entity_no_name is test do
-               var cmd = new CmdEntity(test_view)
+               var cmd = new CmdEntity(test_model)
                var res = cmd.init_command
                assert res isa ErrorMEntityNoName
        end
@@ -53,50 +53,85 @@ class TestCommandsModel
        # CmdComment
 
        fun test_cmd_comment is test do
-               var cmd = new CmdComment(test_view, mentity_name = "test_prog::Character")
+               var cmd = new CmdComment(test_model, mentity_name = "test_prog::Character")
                var res = cmd.init_command
                assert res isa CmdSuccess
                assert cmd.mdoc != null
        end
 
        fun test_cmd_comment_no_mdoc is test do
-               var cmd = new CmdComment(test_view, mentity_name = "test_prog::Character", fallback = false)
+               var cmd = new CmdComment(test_model, mentity_name = "test_prog::Character", fallback = false)
                var res = cmd.init_command
                assert res isa WarningNoMDoc
        end
 
+       # CmdLink
+
+       fun test_cmd_link is test do
+               var cmd = new CmdEntityLink(test_model, mentity_name = "test_prog::Character")
+               var res = cmd.init_command
+               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_link_with_text is test do
+               var cmd = new CmdEntityLink(test_model, mentity_name = "test_prog::Character", text = "foo")
+               var res = cmd.init_command
+               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_link_with_title is test do
+               var cmd = new CmdEntityLink(test_model, mentity_name = "test_prog::Character", title = "bar")
+               var res = cmd.init_command
+               assert res isa CmdSuccess
+               assert cmd.text == "Character"
+               assert cmd.title == "bar"
+       end
+
+       fun test_cmd_link_with_text_and_title is test do
+               var cmd = new CmdEntityLink(test_model, mentity_name = "test_prog::Character",
+                       text = "foo", title = "bar")
+               var res = cmd.init_command
+               assert res isa CmdSuccess
+               assert cmd.text == "foo"
+               assert cmd.title == "bar"
+       end
+
        # CmdInheritance
 
        fun test_cmd_parents is test do
-               var cmd = new CmdParents(test_view, mentity_name = "test_prog::Warrior")
+               var cmd = new CmdParents(test_model, test_main, mentity_name = "test_prog::Warrior")
                var res = cmd.init_command
                assert res isa CmdSuccess
                assert cmd.results.as(not null).length == 1
        end
 
        fun test_cmd_ancestors is test do
-               var cmd = new CmdAncestors(test_view, mentity_name = "test_prog::Warrior")
+               var cmd = new CmdAncestors(test_model, test_main, mentity_name = "test_prog::Warrior")
                var res = cmd.init_command
                assert res isa CmdSuccess
                assert cmd.results.as(not null).length == 2
        end
 
-       fun test_cmd_ancestorsi_without_parents is test do
-               var cmd = new CmdAncestors(test_view, mentity_name = "test_prog::Warrior", parents = false)
+       fun test_cmd_ancestors_without_parents is test do
+               var cmd = new CmdAncestors(test_model, test_main, mentity_name = "test_prog::Warrior", parents = false)
                var res = cmd.init_command
                assert res isa CmdSuccess
                assert cmd.results.as(not null).length == 1
        end
 
        fun test_cmd_children is test do
-               var cmd = new CmdChildren(test_view, mentity_name = "test_prog::Career")
+               var cmd = new CmdChildren(test_model, test_main, mentity_name = "test_prog::Career")
                var res = cmd.init_command
                assert res isa CmdSuccess
                assert cmd.results.as(not null).length == 3
        end
 
        fun test_cmd_descendants is test do
-               var cmd = new CmdDescendants(test_view, mentity_name = "test_prog::Career", children = false)
+               var cmd = new CmdDescendants(test_model, test_main, mentity_name = "test_prog::Career", children = false)
                var res = cmd.init_command
                assert res isa CmdSuccess
                assert cmd.results.as(not null).length == 0
@@ -105,14 +140,14 @@ class TestCommandsModel
        # CmdSearch
 
        fun test_cmd_search is test do
-               var cmd = new CmdSearch(test_view, query = "Carer")
+               var cmd = new CmdSearch(test_model, query = "Carer")
                var res = cmd.init_command
                assert res isa CmdSuccess
                assert cmd.results.as(not null).first.full_name == "test_prog::Career"
        end
 
        fun test_cmd_search_no_query is test do
-               var cmd = new CmdSearch(test_view)
+               var cmd = new CmdSearch(test_model)
                var res = cmd.init_command
                assert res isa ErrorNoQuery
        end
@@ -120,14 +155,14 @@ class TestCommandsModel
        # CmdFeatures
 
        fun test_cmd_features is test do
-               var cmd = new CmdFeatures(test_view, mentity_name = "test_prog::Career")
+               var cmd = new CmdFeatures(test_model, mentity_name = "test_prog::Career")
                var res = cmd.init_command
                assert res isa CmdSuccess
                assert cmd.results.as(not null).length == 10
        end
 
        fun test_cmd_features_no_features is test do
-               var cmd = new CmdFeatures(test_view, mentity_name = "test_prog$Career$strength_bonus")
+               var cmd = new CmdFeatures(test_model, mentity_name = "test_prog$Career$strength_bonus")
                var res = cmd.init_command
                assert res isa WarningNoFeatures
        end
@@ -135,15 +170,14 @@ class TestCommandsModel
        # CmdLinearization
 
        fun test_cmd_lin is test do
-               var cmd = new CmdLinearization(test_view, mentity_name = "init")
+               var cmd = new CmdLinearization(test_model, test_main, mentity_name = "init")
                var res = cmd.init_command
                assert res isa CmdSuccess
-               print cmd.results.as(not null)
                assert cmd.results.as(not null).length == 10
        end
 
        fun test_cmd_lin_no_lin is test do
-               var cmd = new CmdLinearization(test_view, mentity_name = "test_prog")
+               var cmd = new CmdLinearization(test_model, test_main, mentity_name = "test_prog")
                var res = cmd.init_command
                assert res isa WarningNoLinearization
        end
@@ -151,14 +185,14 @@ class TestCommandsModel
        # CmdCode
 
        fun test_cmd_code is test do
-               var cmd = new CmdCode(test_view, test_builder, mentity_name = "test_prog::Career")
+               var cmd = new CmdEntityCode(test_model, test_builder, mentity_name = "test_prog::Career")
                var res = cmd.init_command
                assert res isa CmdSuccess
                assert cmd.node isa AStdClassdef
        end
 
        fun test_cmd_code_no_code is test do
-               var cmd = new CmdCode(test_view, test_builder, mentity_name = "test_prog")
+               var cmd = new CmdEntityCode(test_model, test_builder, mentity_name = "test_prog")
                var res = cmd.init_command
                assert res isa WarningNoCode
        end
@@ -166,14 +200,14 @@ class TestCommandsModel
        # CmdModel
 
        fun test_cmd_results is test do
-               var cmd = new CmdModelEntities(test_view, kind = "modules")
+               var cmd = new CmdModelEntities(test_model, kind = "modules")
                var res = cmd.init_command
                assert res isa CmdSuccess
                assert cmd.results.as(not null).length == 10
        end
 
        fun test_cmd_results_random is test do
-               var cmd = new CmdRandomEntities(test_view, kind = "packages")
+               var cmd = new CmdRandomEntities(test_model, kind = "packages")
                var res = cmd.init_command
                assert res isa CmdSuccess
                assert cmd.results.as(not null).length == 2