about summary refs log tree commit diff
path: root/src/test.cc
diff options
context:
space:
mode:
authorEelco Dolstra <e.dolstra@tudelft.nl>2003-06-27T13·55+0000
committerEelco Dolstra <e.dolstra@tudelft.nl>2003-06-27T13·55+0000
commit3da9687854e029e9df3b612fd592d2d5a622bb20 (patch)
tree4b51f62373c134bb80ff5aac51ffe613eef755e6 /src/test.cc
parentbb03c45ca03e038c8b74fc1410f48d02ade4c59b (diff)
* Realisation of File(...) expressions.
Diffstat (limited to 'src/test.cc')
-rw-r--r--src/test.cc36
1 files changed, 25 insertions, 11 deletions
diff --git a/src/test.cc b/src/test.cc
index d912eaa6a77d..aafae8ee37ff 100644
--- a/src/test.cc
+++ b/src/test.cc
@@ -11,20 +11,16 @@
 #include "globals.hh"
 
 
-typedef Expr (* Normaliser) (Expr);
-
-
-void eval(Normaliser n, Expr e)
+void realise(FState fs)
 {
-    e = n(e);
-    cout << (string) hashExpr(e) << ": " << printExpr(e) << endl;
+    realiseFState(fs);
 }
 
 
-void evalFail(Normaliser n, Expr e)
+void realiseFail(FState fs)
 {
     try {
-        e = n(e);
+        realiseFState(fs);
         abort();
     } catch (Error e) {
         cout << "error (expected): " << e.what() << endl;
@@ -96,7 +92,7 @@ void runTests()
     string testDir = absPath("scratch");
     cout << testDir << endl;
 
-    nixValues = testDir;
+    nixStore = testDir;
     nixLogDir = testDir;
     nixDB = testDir + "/db";
 
@@ -104,6 +100,7 @@ void runTests()
 
     /* Expression evaluation. */
 
+#if 0
     eval(whNormalise,
         ATmake("Str(\"Hello World\")"));
     eval(whNormalise,
@@ -138,10 +135,27 @@ void runTests()
     eval(fNormalise, e2);
 
     realise(e2);
+#endif
 
-#if 0
-    Hash builder1 = addValue("./test-builder-1.sh");
+    Hash builder1h;
+    string builder1fn;
+    addToStore("./test-builder-1.sh", builder1fn, builder1h);
+
+    FState fs1 = ATmake(
+        "File(<str>, Hash(<str>), [])", 
+        builder1fn.c_str(),
+        ((string) builder1h).c_str());
+    realiseFState(fs1);
+    realiseFState(fs1);
 
+    FState fs2 = ATmake(
+        "File(<str>, Hash(<str>), [])", 
+        (builder1fn + "_bla").c_str(),
+        ((string) builder1h).c_str());
+    realiseFState(fs2);
+    realiseFState(fs2);
+
+#if 0
     Expr e1 = ATmake("Exec(Str(<str>), Hash(<str>), [])",
         thisSystem.c_str(), ((string) builder1).c_str());