Test.GtkWriter.vala.c
[app.Builder.js] / Test.GtkWriter.vala
index ea03247..a5a9254 100644 (file)
@@ -4,23 +4,61 @@
 
 */
 
-public static int main () {
 
+void diff(string original, string data)
+{
+       
+       FileUtils.set_contents("/tmp/test.out",data);
+       string[] spawn_args = {"diff", "-w" , "-u", original, "/tmp/test.out" };
+       
+       
+       string[] spawn_env = Environ.get ();
+       int ls_status;
+       Process.spawn_sync ("/",
+                                                       spawn_args,
+                                                       spawn_env,
+                                                       SpawnFlags.SEARCH_PATH,
+                                                       null,
+                                                       null,
+                                                       null,
+                                                       out ls_status);
+        
+
+}
 
-       var proj = new Project.Gtk( "/home/alan/gitlive/app.Builder.js/Builder4");
+void testBuilderFile(string name, string test)
+{
+       var dir = "/home/alan/gitlive/app.Builder.js/Builder4"; 
+       var proj = new Project.Gtk(dir );
        proj.scanDirs();
-       print(proj.toJSON(true));
-       print("\ndone\n");
-       var tf = proj.files.get("/home/alan/gitlive/app.Builder.js/Builder4/Editor.bjs");
+       //print(proj.toJSON(true));
+       //print("\ndone\n");
+       var tf = proj.files.get(dir + "/" + name + ".bjs");
        tf.loadItems();
-       
-       
-       //var tf = proj.files['/home/alan/gitlive/app.Builder/Builder4/Editor.bjs'];
-       //tf.loadItems(function() {
-       //      print(JSON.stringify(tf,null,4));
-       //      
-               
-       //}, true); 
+       switch(test) {
+               case "JSON":
+                       diff(dir + "/" + name + ".bjs", tf.toJsonString());
+                       return;
+               case "JS":
+                       diff(dir + "/" + name + ".js", tf.toSource());
+                       return;
+               case "VALA":
+                       diff(dir + "/" + name + ".vala", tf.toValaSource(false));
+                       return;
+       }
+       print("invalid test?\n");
+}
+
+public static int main () {
+    new JsRender.Lang_Class();
+       GLib.Log.set_always_fatal(LogLevelFlags.LEVEL_ERROR | LogLevelFlags.LEVEL_CRITICAL); 
 
+
+       //testBuilderFile("Editor", "JSON");
+       //testBuilderFile("Editor", "JS");
+       testBuilderFile("Editor", "VALA");
+
+    
+       
        return 0;
 }
\ No newline at end of file