Merge: lib/core: provide default codec-aware read_char
[nit.git] / src / doc / commands / tests / test_commands_ini.nit
1 # This file is part of NIT ( http://www.nitlanguage.org ).
2 #
3 # Licensed under the Apache License, Version 2.0 (the "License");
4 # you may not use this file except in compliance with the License.
5 # You may obtain a copy of the License at
6 #
7 # http://www.apache.org/licenses/LICENSE-2.0
8 #
9 # Unless required by applicable law or agreed to in writing, software
10 # distributed under the License is distributed on an "AS IS" BASIS,
11 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 # See the License for the specific language governing permissions and
13 # limitations under the License.
14
15 module test_commands_ini is test
16
17 import test_commands
18 import doc::commands::commands_ini
19
20 class TestCommandsIni
21 super TestCommands
22 test
23
24 # CmdIni
25
26 fun test_cmd_ini_desc is test do
27 var cmd = new CmdIniDescription(test_view, mentity_name = "test_prog")
28 var res = cmd.init_command
29 assert res isa CmdSuccess
30 assert cmd.desc == "Dummy program used for testing Nit tools"
31 end
32
33 fun test_cmd_ini_git is test do
34 var cmd = new CmdIniGitUrl(test_view, mentity_name = "test_prog")
35 var res = cmd.init_command
36 assert res isa CmdSuccess
37 assert cmd.url == "https://github.com/nitlang/nit.git"
38 end
39
40 fun test_cmd_ini_clone is test do
41 var cmd = new CmdIniCloneCommand(test_view, mentity_name = "test_prog")
42 var res = cmd.init_command
43 assert res isa CmdSuccess
44 assert cmd.url == "https://github.com/nitlang/nit.git"
45 assert cmd.command == "git clone https://github.com/nitlang/nit.git"
46 end
47
48 fun test_cmd_ini_issues is test do
49 var cmd = new CmdIniIssuesUrl(test_view, mentity_name = "test_prog")
50 var res = cmd.init_command
51 assert res isa CmdSuccess
52 assert cmd.url == "https://github.com/nitlang/nit/issues"
53 end
54
55 fun test_cmd_ini_maintainer is test do
56 var cmd = new CmdIniMaintainer(test_view, mentity_name = "test_prog")
57 var res = cmd.init_command
58 assert res isa CmdSuccess
59 assert cmd.maintainer == "John Doe <jdoe@example.com> (http://www.example.com/~jdoe), Spider-Man"
60 end
61
62 fun test_cmd_ini_contributors is test do
63 var cmd = new CmdIniContributors(test_view, mentity_name = "test_prog")
64 var res = cmd.init_command
65 assert res isa CmdSuccess
66 assert cmd.contributors == [
67 "Riri <riri@example.com>",
68 "Fifi (http://www.example.com/~fifi)",
69 "Loulou"]
70 end
71
72 fun test_cmd_ini_license is test do
73 var cmd = new CmdIniLicense(test_view, mentity_name = "test_prog")
74 var res = cmd.init_command
75 assert res isa CmdSuccess
76 assert cmd.license == "Apache-2.0"
77 end
78
79 fun test_cmd_ini_license_file is test do
80 var cmd = new CmdLicenseFile(test_view, mentity_name = "test_prog")
81 var res = cmd.init_command
82 assert res isa CmdSuccess
83
84 var file = cmd.file
85 assert file != null
86 assert file.basename == "LICENSE.md"
87 end
88
89 fun test_cmd_ini_license_file_content is test do
90 var cmd = new CmdLicenseFileContent(test_view, mentity_name = "test_prog")
91 var res = cmd.init_command
92 assert res isa CmdSuccess
93
94 var content = cmd.content
95 assert content != null
96 assert not content.is_empty
97 end
98
99 fun test_cmd_ini_contrib_file is test do
100 var cmd = new CmdContribFile(test_view, mentity_name = "test_prog")
101 var res = cmd.init_command
102 assert res isa CmdSuccess
103
104 var file = cmd.file
105 assert file != null
106 assert file.basename == "CONTRIBUTING.md"
107 end
108
109 fun test_cmd_ini_contrib_file_content is test do
110 var cmd = new CmdContribFileContent(test_view, mentity_name = "test_prog")
111 var res = cmd.init_command
112 assert res isa CmdSuccess
113
114 var content = cmd.content
115 assert content != null
116 assert not content.is_empty
117 end
118 end