Merge: doc: fixed some typos and other misc. corrections
[nit.git] / src / doc / commands / tests / test_commands_parser.nit
index 9b34cc8..f5d6699 100644 (file)
@@ -25,7 +25,7 @@ class TestCommandsParser
        # CmdEntity
 
        fun test_cmd_parser_comment is test do
-               var parser = new CommandParser(test_model, test_main, test_builder, test_catalog, test_filter)
+               var parser = new CommandParser(test_model, test_main, test_builder, test_catalog)
                var cmd = parser.parse("doc: test_prog::Character")
                assert cmd isa CmdComment
                assert parser.error == null
@@ -160,7 +160,7 @@ class TestCommandsParser
 
        fun test_cmd_parser_ancestors_without_parents is test do
                var parser = new CommandParser(test_model, test_main, test_builder, test_catalog)
-               var cmd = parser.parse("ancestors: test_prog::Warrior | parents: false")
+               var cmd = parser.parse("ancestors: test_prog::Warrior | no-parents")
                assert cmd isa CmdAncestors
                assert parser.error == null
                assert cmd.results.as(not null).length == 1
@@ -184,16 +184,24 @@ class TestCommandsParser
 
        fun test_cmd_parser_descendants_without_children is test do
                var parser = new CommandParser(test_model, test_main, test_builder, test_catalog)
-               var cmd = parser.parse("descendants: Object | children: false")
+               var cmd = parser.parse("descendants: Object | no-children: true")
                assert cmd isa CmdDescendants
                assert parser.error == null
                assert cmd.results.as(not null).length == 9
        end
 
+       fun test_cmd_parser_ancestors_with_filter_match is test do
+               var parser = new CommandParser(test_model, test_main, test_builder, test_catalog)
+               var cmd = parser.parse("ancestors: test_prog::Warrior | match: Object")
+               assert cmd isa CmdAncestors
+               assert parser.error == null
+               assert cmd.results.as(not null).length == 1
+       end
+
        # CmdSearch
 
        fun test_cmd_parser_search is test do
-               var parser = new CommandParser(test_model, test_main, test_builder, test_catalog, test_filter)
+               var parser = new CommandParser(test_model, test_main, test_builder, test_catalog)
                var cmd = parser.parse("search: Caracter")
                assert cmd isa CmdSearch
                assert parser.error == null
@@ -201,8 +209,8 @@ class TestCommandsParser
        end
 
        fun test_cmd_parser_search_limit is test do
-               var parser = new CommandParser(test_model, test_main, test_builder, test_catalog, test_filter)
-               var cmd = parser.parse("search: Caracter | limit: 2")
+               var parser = new CommandParser(test_model, test_main, test_builder, test_catalog)
+               var cmd = parser.parse("search: strength | limit: 2")
                assert cmd isa CmdSearch
                assert parser.error == null
                assert cmd.results.as(not null).length == 2
@@ -211,7 +219,7 @@ class TestCommandsParser
        # CmdFeatures
 
        fun test_cmd_parser_features is test do
-               var parser = new CommandParser(test_model, test_main, test_builder, test_catalog, test_filter)
+               var parser = new CommandParser(test_model, test_main, test_builder, test_catalog)
                var cmd = parser.parse("defs: test_prog::Character")
                assert cmd isa CmdFeatures
                assert parser.error == null
@@ -219,17 +227,25 @@ class TestCommandsParser
        end
 
        fun test_cmd_parser_features_limit is test do
-               var parser = new CommandParser(test_model, test_main, test_builder, test_catalog, test_filter)
+               var parser = new CommandParser(test_model, test_main, test_builder, test_catalog)
                var cmd = parser.parse("defs: test_prog::Character | limit: 2")
                assert cmd isa CmdFeatures
                assert parser.error == null
                assert cmd.results.as(not null).length == 2
        end
 
+       fun test_cmd_parser_with_filter_inherited is test do
+               var parser = new CommandParser(test_model, test_main, test_builder, test_catalog)
+               var cmd = parser.parse("defs: test_prog::TestGame | inherited: TestGame")
+               assert cmd isa CmdFeatures
+               assert parser.error == null
+               assert cmd.results.as(not null).length == 4
+       end
+
        # CmdLinearization
 
        fun test_cmd_parser_lin is test do
-               var parser = new CommandParser(test_model, test_main, test_builder, test_catalog, test_filter)
+               var parser = new CommandParser(test_model, test_main, test_builder, test_catalog)
                var cmd = parser.parse("lin: test_prog::Character")
                assert cmd isa CmdLinearization
                assert parser.error == null
@@ -237,7 +253,7 @@ class TestCommandsParser
        end
 
        fun test_cmd_parser_lin_limit is test do
-               var parser = new CommandParser(test_model, test_main, test_builder, test_catalog, test_filter)
+               var parser = new CommandParser(test_model, test_main, test_builder, test_catalog)
                var cmd = parser.parse("lin: test_prog::Character | limit: 2")
                assert cmd isa CmdLinearization
                assert parser.error == null
@@ -247,7 +263,7 @@ class TestCommandsParser
        # CmdCode
 
        fun test_cmd_parser_code is test do
-               var parser = new CommandParser(test_model, test_main, test_builder, test_catalog, test_filter)
+               var parser = new CommandParser(test_model, test_main, test_builder, test_catalog)
                var cmd = parser.parse("code: test_prog::Character")
                assert cmd isa CmdEntityCode
                assert parser.error == null
@@ -257,7 +273,7 @@ class TestCommandsParser
        # CmdModel
 
        fun test_cmd_parser_mentities is test do
-               var parser = new CommandParser(test_model, test_main, test_builder, test_catalog, test_filter)
+               var parser = new CommandParser(test_model, test_main, test_builder, test_catalog)
                var cmd = parser.parse("list: modules")
                assert cmd isa CmdModelEntities
                assert parser.error == null
@@ -265,7 +281,7 @@ class TestCommandsParser
        end
 
        fun test_cmd_parser_results_mentities is test do
-               var parser = new CommandParser(test_model, test_main, test_builder, test_catalog, test_filter)
+               var parser = new CommandParser(test_model, test_main, test_builder, test_catalog)
                var cmd = parser.parse("random: modules")
                assert cmd isa CmdRandomEntities
                assert parser.error == null
@@ -275,7 +291,7 @@ class TestCommandsParser
        # CmdGraph
 
        fun test_cmd_parser_uml is test do
-               var parser = new CommandParser(test_model, test_main, test_builder, test_catalog, test_filter)
+               var parser = new CommandParser(test_model, test_main, test_builder, test_catalog)
                var cmd = parser.parse("uml: test_prog::Career")
                assert cmd isa CmdUML
                assert parser.error == null
@@ -283,7 +299,7 @@ class TestCommandsParser
        end
 
        fun test_cmd_parser_inh_graph is test do
-               var parser = new CommandParser(test_model, test_main, test_builder, test_catalog, test_filter)
+               var parser = new CommandParser(test_model, test_main, test_builder, test_catalog)
                var cmd = parser.parse("graph: test_prog::Career")
                assert cmd isa CmdInheritanceGraph
                assert parser.error == null
@@ -291,7 +307,7 @@ class TestCommandsParser
        end
 
        fun test_cmd_parser_inh_graph_opts is test do
-               var parser = new CommandParser(test_model, test_main, test_builder, test_catalog, test_filter)
+               var parser = new CommandParser(test_model, test_main, test_builder, test_catalog)
                var cmd = parser.parse("graph: test_prog::Career | cdepth: 2, pdepth: 5")
                assert cmd isa CmdInheritanceGraph
                assert parser.error == null
@@ -303,7 +319,7 @@ class TestCommandsParser
        # CmdUsage
 
        fun test_cmd_parser_new is test do
-               var parser = new CommandParser(test_model, test_main, test_builder, test_catalog, test_filter)
+               var parser = new CommandParser(test_model, test_main, test_builder, test_catalog)
                var cmd = parser.parse("new: test_prog::Career")
                assert cmd isa CmdNew
                assert parser.error == null
@@ -311,7 +327,7 @@ class TestCommandsParser
        end
 
        fun test_cmd_parser_call is test do
-               var parser = new CommandParser(test_model, test_main, test_builder, test_catalog, test_filter)
+               var parser = new CommandParser(test_model, test_main, test_builder, test_catalog)
                var cmd = parser.parse("call: strength_bonus")
                assert cmd isa CmdCall
                assert parser.error == null
@@ -319,7 +335,7 @@ class TestCommandsParser
        end
 
        fun test_cmd_parser_return is test do
-               var parser = new CommandParser(test_model, test_main, test_builder, test_catalog, test_filter)
+               var parser = new CommandParser(test_model, test_main, test_builder, test_catalog)
                var cmd = parser.parse("return: test_prog::Career")
                assert cmd isa CmdReturn
                assert parser.error == null
@@ -327,7 +343,7 @@ class TestCommandsParser
        end
 
        fun test_cmd_parser_param is test do
-               var parser = new CommandParser(test_model, test_main, test_builder, test_catalog, test_filter)
+               var parser = new CommandParser(test_model, test_main, test_builder, test_catalog)
                var cmd = parser.parse("param: test_prog::Career")
                assert cmd isa CmdParam
                assert parser.error == null
@@ -337,7 +353,7 @@ class TestCommandsParser
        # CmdCatalog
 
        fun test_parser_catalog_search is test do
-               var parser = new CommandParser(test_model, test_main, test_builder, test_catalog, test_filter)
+               var parser = new CommandParser(test_model, test_main, test_builder, test_catalog)
                var cmd = parser.parse("search: Caracter")
                assert cmd isa CmdSearch
                assert parser.error == null
@@ -345,7 +361,7 @@ class TestCommandsParser
        end
 
        fun test_cmd_parser_catalog_packages is test do
-               var parser = new CommandParser(test_model, test_main, test_builder, test_catalog, test_filter)
+               var parser = new CommandParser(test_model, test_main, test_builder, test_catalog)
                var cmd = parser.parse("catalog:")
                assert cmd isa CmdCatalogPackages
                assert parser.error == null
@@ -353,7 +369,7 @@ class TestCommandsParser
        end
 
        fun test_cmd_parser_catalog_stats is test do
-               var parser = new CommandParser(test_model, test_main, test_builder, test_catalog, test_filter)
+               var parser = new CommandParser(test_model, test_main, test_builder, test_catalog)
                var cmd = parser.parse("stats:")
                assert cmd isa CmdCatalogStats
                assert parser.error == null
@@ -361,7 +377,7 @@ class TestCommandsParser
        end
 
        fun test_cmd_parser_catalog_tags is test do
-               var parser = new CommandParser(test_model, test_main, test_builder, test_catalog, test_filter)
+               var parser = new CommandParser(test_model, test_main, test_builder, test_catalog)
                var cmd = parser.parse("tags:")
                assert cmd isa CmdCatalogTags
                assert parser.error == null
@@ -369,7 +385,7 @@ class TestCommandsParser
        end
 
        fun test_cmd_parser_catalog_tag is test do
-               var parser = new CommandParser(test_model, test_main, test_builder, test_catalog, test_filter)
+               var parser = new CommandParser(test_model, test_main, test_builder, test_catalog)
                var cmd = parser.parse("tag: test")
                assert cmd isa CmdCatalogTag
                assert parser.error == null
@@ -378,7 +394,7 @@ class TestCommandsParser
        end
 
        fun test_cmd_parser_catalog_person is test do
-               var parser = new CommandParser(test_model, test_main, test_builder, test_catalog, test_filter)
+               var parser = new CommandParser(test_model, test_main, test_builder, test_catalog)
                var cmd = parser.parse("person: Alexandre Terrasa")
                assert cmd isa CmdCatalogPerson
                assert parser.error == null
@@ -386,7 +402,7 @@ class TestCommandsParser
        end
 
        fun test_cmd_parser_catalog_contributing is test do
-               var parser = new CommandParser(test_model, test_main, test_builder, test_catalog, test_filter)
+               var parser = new CommandParser(test_model, test_main, test_builder, test_catalog)
                var cmd = parser.parse("contrib: Alexandre Terrasa")
                assert cmd isa CmdCatalogContributing
                assert parser.error == null
@@ -395,7 +411,7 @@ class TestCommandsParser
        end
 
        fun test_cmd_parser_catalog_maintaining is test do
-               var parser = new CommandParser(test_model, test_main, test_builder, test_catalog, test_filter)
+               var parser = new CommandParser(test_model, test_main, test_builder, test_catalog)
                var cmd = parser.parse("maintain: Alexandre Terrasa")
                assert cmd isa CmdCatalogMaintaining
                assert parser.error == null