neo_doxygen: Add a class to manage brief descriptions.
[nit.git] / contrib / neo_doxygen / src / tests / neo_doxygen_descriptions.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 import model::descriptions
16
17 # Copied from the documentation of `Documentation`.
18
19 var doc = new Documentation
20
21 doc.brief_description = "Do something."
22 doc.detailed_description = ["Do not lunch a rocket."]
23 assert doc.brief_description == "Do something."
24 assert doc.detailed_description == ["Do not lunch a rocket."]
25 assert doc.to_json == """["Do something.","Do not lunch a rocket."]"""
26
27 doc.brief_description = ""
28 doc.detailed_description = ["The answer is `42`."]
29 assert doc.brief_description == "The answer is `42`."
30 assert doc.detailed_description == ["The answer is `42`."]
31 assert doc.to_json == """["The answer is `42`."]"""
32
33 doc.detailed_description = ["The answer is `42`."]
34 doc.brief_description = ""
35 assert doc.brief_description == "The answer is `42`."
36 assert doc.detailed_description == ["The answer is `42`."]
37 assert doc.to_json == """["The answer is `42`."]"""
38
39 doc.detailed_description = new Array[String]
40 doc.brief_description = ""
41 assert doc.is_empty
42 assert doc.brief_description == ""
43 assert doc.detailed_description == new Array[String]
44 assert doc.to_json == "[]"