diff src/docgen/tests/parse.d @ 806:bcb74c9b895c

Moved out files in the trunk folder to the root.
author Aziz K?ksal <aziz.koeksal@gmail.com>
date Sun, 09 Mar 2008 00:12:19 +0100
parents trunk/src/docgen/tests/parse.d@231c9a44ba8e
children
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/docgen/tests/parse.d	Sun Mar 09 00:12:19 2008 +0100
@@ -0,0 +1,65 @@
+/**
+ * Author: Jari-Matti Mäkelä
+ * License: GPL3
+ */
+module docgen.tests.parse;
+
+import docgen.misc.parser;
+import tango.io.FileConduit;
+import tango.io.Print: Print;
+import tango.text.convert.Layout : Layout;
+
+void saveToFile(char[] fname, void delegate(Print!(char) file) foo) {
+  auto file = new FileConduit("docgen/teststuff/" ~ fname, FileConduit.WriteCreate);
+  auto output = new Print!(char)(new Layout!(char), file);
+  
+  foo(output);
+  
+  file.close();
+}
+
+// load some test files
+//@unittest
+void parse1() {
+  saveToFile("parse1.txt", (Print!(char) file){
+    Module[] modules;
+  
+    Parser.loadModules(
+      [ "c" ], [ "docgen/teststuff/" ],
+      null, true, -1,
+      (char[] fqn, char[] path, Module m) {
+        file.format("{0} = {1}\n", fqn, path);
+      },
+      (Module imported, Module importer, bool isPublic, bool isStatic) {
+        file.format("{0} <- {1}\n",
+          imported ? imported.moduleFQN : "null"[],
+          importer ? importer.moduleFQN : "null"[]
+        );
+      },
+      modules
+    );
+  });
+}
+
+// load the imports of dil
+//@unittest
+void parse2() {
+  saveToFile("parse2.txt", (Print!(char) file){
+    Module[] modules;
+    
+    Parser.loadModules(
+      [ "docgen/testsuite" ], [".", "/home/jm/d/tango/"],
+      null, true, -1,
+      (char[] fqn, char[] path, Module m) {
+        file.format("{0} = {1}\n", fqn, path);
+      },
+      (Module imported, Module importer, bool isPublic, bool isStatic) {
+        file.format("{0} <- {1}\n",
+          imported ? imported.moduleFQN : "null"[],
+          importer ? importer.moduleFQN : "null"[]
+        );
+      },
+      modules
+    );
+  });
+}