1 # This file is part of NIT ( http://www.nitlanguage.org ).
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
7 # http://www.apache.org/licenses/LICENSE-2.0
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.
15 module test_commands_ini
is test
18 import doc
::commands
::commands_ini
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"
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"
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"
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"
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"
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)",
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"
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
86 assert file
.basename
== "LICENSE.md"
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
94 var content
= cmd
.content
95 assert content
!= null
96 assert not content
.is_empty
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
106 assert file
.basename
== "CONTRIBUTING.md"
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
114 var content
= cmd
.content
115 assert content
!= null
116 assert not content
.is_empty