neo_doxygen: Manage top-level namespaces in `doxml`.
[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.full_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.put_in_graph
40
41 file_2.full_name = "Bar.java"
42 file_2.model_id = "_Bar_8java_2"
43 location = new Location
44 location.path = "Bar.java"
45 file_2.location = location
46 file_2.declare_namespace("namespacec", "c")
47 file_2.declare_namespace("", "d")
48 file_2.put_in_graph
49
50 bar_class.model_id = "classa_b_bar"
51 bar_class.full_name = "a::b::Bar"
52 location = new Location
53 location.path = "a/b/Bar.class"
54 location.line_start = 5
55 location.column_start = 1
56 location.line_end = 100
57 location.column_end = 10
58 bar_class.location = location
59 bar_class.put_in_graph
60
61 baz_class.model_id = "classbaz"
62 baz_class.full_name = "Baz"
63 location = new Location
64 location.path = "Baz.jar"
65 baz_class.location = location
66 baz_class.put_in_graph
67
68 root_ns.declare_namespace("", "a")
69 root_ns.declare_namespace("namespacec", "c")
70 root_ns.declare_namespace("", "d")
71
72 a_ns.full_name = "a"
73 a_ns.declare_namespace("", "a::b")
74 a_ns.put_in_graph
75
76 b_ns.full_name = "a::b"
77 b_ns.declare_class("classa_b_bar", "", "")
78 b_ns.put_in_graph
79
80 c_ns.model_id = "namespacec"
81 c_ns.full_name = "c"
82 c_ns.put_in_graph
83
84 d_ns.model_id = "namespaced"
85 d_ns.full_name = "d"
86 d_ns.put_in_graph
87
88 print "---===WITHOUT GLOBALS===---"
89 graph.put_edges
90 graph.debug buffer
91 print buffer
92
93 print "---===WITH GLOBALS===---"
94 buffer.clear
95 graph.add_global_modules
96 graph.put_edges
97 graph.debug buffer
98 print buffer