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 import model
::descriptions
17 # Copied from the documentation of `Documentation`.
19 var doc
= new Documentation
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."]"""
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`."]"""
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`."]"""
39 doc
.detailed_description
= new Array[String]
40 doc
.brief_description
= ""
42 assert doc
.brief_description
== ""
43 assert doc
.detailed_description
== new Array[String]
44 assert doc
.to_json
== "[]"