resources/RooUsage.txt
[app.Builder.js] / tests / ValaWrite.vala
1 /**
2  * Test the writer code...
3
4
5 */
6
7
8 void diff(string original, string data)
9 {
10         
11         FileUtils.set_contents("/tmp/test.out",data);
12         string[] spawn_args = {"diff", "-w" , "-u", original, "/tmp/test.out" };
13         
14         
15         string[] spawn_env = Environ.get ();
16         int ls_status;
17         Process.spawn_sync ("/",
18                                                         spawn_args,
19                                                         spawn_env,
20                                                         SpawnFlags.SEARCH_PATH,
21                                                         null,
22                                                         null,
23                                                         null,
24                                                         out ls_status);
25          
26
27 }
28
29
30
31 int main (string[] args) {
32         Gtk.init (ref args);
33         //GtkClutter.init (ref args);
34         new JsRender.Lang_Class();
35         GLib.Log.set_always_fatal(LogLevelFlags.LEVEL_ERROR | LogLevelFlags.LEVEL_CRITICAL);
36
37
38         
39         Project.Project.loadAll();
40         var p = Project.Project.getProject("Builder4");
41         p.scanDirs();
42         var ar = p.sortedFiles();
43         var iter = ar.list_iterator();
44         while (iter.next()) {
45                 var f= iter.get();
46                 f.loadItems();
47
48                 // syntax check..
49                  
50
51                 
52                 print("\n%s\n",f.toJsonString());
53                 diff(p.firstPath() + "/" + f.name + ".vala", JsRender.NodeToVala.mungeFile(f));
54                 //var str= 
55                 //print("\n%s\n",str);
56                 //return 0;
57         }
58     
59         
60         return 0;
61 }
62
63
64 void testGir() {
65
66
67         var test = Palete.Gir.factoryFqn("Gtk.Label.new");
68         if (test == null) {
69                 print("could not find Gtk.Label.new\n");
70                 return;
71         }
72
73         
74         var generator = new Json.Generator ();
75         var n = new Json.Node(Json.NodeType.OBJECT);
76         n.set_object(test.toJSON());
77         generator.set_root(n);
78         generator.indent = 4;
79         generator.pretty = true;
80     
81         print(generator.to_data(null));
82         
83 }