ci: do not error when nothing with nitunit_some
[nit.git] / contrib / neo_doxygen / src / tests / tests.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 # Base module for tests related to `neo_doxygen`.
16 module tests::tests
17
18 import model::graph
19
20 # Adds debugging output to graphs.
21 redef class NeoGraph
22
23 # Append the debugging output of all relationships to the specified buffer.
24 fun debug(buffer: Buffer) do
25 buffer.append "# Graph\n"
26 for edge in all_edges do
27 edge.debug buffer
28 end
29 end
30 end
31
32 # Adds debugging output to relationships.
33 redef class NeoEdge
34
35 # Append the debugging output of this relationship to the specified buffer.
36 #
37 # Append the relationship type, the properties, and the debugging output of
38 # both extremities.
39 fun debug(buffer: Buffer) do
40 var rel_type = self.rel_type or else "?"
41 buffer.append "Edge\n"
42 buffer.append "=type={rel_type.length}:{rel_type}\n"
43 buffer.append "=properties=JsonObject({properties.length}):\n"
44 buffer.append properties.to_json
45 buffer.append "\n----\n=from="
46 from.debug buffer
47 buffer.append "----\n=to="
48 to.debug buffer
49 buffer.append "\n"
50 end
51 end
52
53 # Adds debugging output to nodes.
54 redef class NeoNode
55
56 # Append the debugging output of this node to the specified buffer.
57 #
58 # Append the labels and the properties.
59 fun debug(buffer: Buffer) do
60 buffer.append "Node\n"
61 buffer.append "=labels=Array({labels.length}):\n"
62 for lab in labels do buffer.append "{lab.length}:{lab}\n"
63 buffer.append "=properties=JsonObject({properties.length}):\n"
64 buffer.append properties.to_json
65 buffer.append "\n"
66 end
67 end
68
69 # Adds debugging output to entities.
70 redef class Entity
71
72 # Append the debugging output of this entity to the specified buffer.
73 #
74 # Append the `model_id`, the labels and the properties.
75 redef fun debug(buffer) do
76 buffer.append "Entity#{model_id.length}:{model_id}\n"
77 buffer.append "=labels=Array({labels.length}):\n"
78 for lab in labels do buffer.append "{lab.length}:{lab}\n"
79 buffer.append "=properties=JsonObject({properties.length}):\n"
80 buffer.append properties.to_json
81 buffer.append "\n"
82 end
83 end