neo_doxygen: Document modules.
[nit.git] / contrib / neo_doxygen / src / tests / neo_doxygen_file_compound.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 tests
16 import model::module_compound
17
18 var graph = new ProjectGraph("foo")
19 var file = new FileCompound(graph)
20 var file_2 = new FileCompound(graph)
21 var bar_class = new ClassCompound(graph)
22 var baz_class = new ClassCompound(graph)
23 var a_ns = new Namespace(graph)
24 var b_ns = new Namespace(graph)
25 var c_ns = new Namespace(graph)
26 var d_ns = new Namespace(graph)
27 var buffer = new RopeBuffer
28 var root_ns = graph.by_id[""].as(Namespace)
29 var location: Location
30
31 file.name = "Bar.java"
32 file.model_id = "_Bar_8java"
33 location = new Location
34 location.path = "a/b/Bar.java"
35 file.location = location
36 file.declare_class("classa_b_bar", "a::b::Bar", "package")
37 file.declare_class("classbaz", "Baz", "")
38 file.declare_namespace("", "a::b")
39 file.doc.add "The first file."
40 file.put_in_graph
41
42 file_2.name = "Bar.java"
43 file_2.model_id = "_Bar_8java_2"
44 location = new Location
45 location.path = "Bar.java"
46 file_2.location = location
47 file_2.declare_namespace("namespacec", "c")
48 file_2.declare_namespace("", "d")
49 file_2.put_in_graph
50
51 bar_class.model_id = "classa_b_bar"
52 bar_class.name = "Bar"
53 location = new Location
54 location.path = "a/b/Bar.class"
55 location.line_start = 5
56 location.column_start = 1
57 location.line_end = 100
58 location.column_end = 10
59 bar_class.location = location
60 bar_class.put_in_graph
61
62 baz_class.model_id = "classbaz"
63 baz_class.name = "Baz"
64 location = new Location
65 location.path = "Baz.jar"
66 baz_class.location = location
67 baz_class.put_in_graph
68
69 root_ns.declare_namespace("", "a")
70 root_ns.declare_namespace("namespacec", "c")
71 root_ns.declare_namespace("", "d")
72
73 a_ns.name = "a"
74 a_ns.full_name = "a"
75 a_ns.declare_namespace("", "a::b")
76 a_ns.put_in_graph
77
78 b_ns.name = "b"
79 b_ns.full_name = "a::b"
80 b_ns.declare_class("classa_b_bar", "", "")
81 b_ns.put_in_graph
82
83 c_ns.model_id = "namespacec"
84 c_ns.name = "c"
85 c_ns.full_name = "c"
86 c_ns.put_in_graph
87
88 d_ns.model_id = "namespaced"
89 d_ns.name = "d"
90 d_ns.full_name = "d"
91 d_ns.put_in_graph
92
93 print "---===WITHOUT GLOBALS===---"
94 graph.put_edges
95 graph.debug buffer
96 print buffer
97
98 print "---===WITH GLOBALS===---"
99 buffer.clear
100 graph.add_global_modules
101 graph.put_edges
102 graph.debug buffer
103 print buffer