describe ("Test the basic functionality of dust", function() {
  for (var index = 0; index < coreTests.length; index++) {
    for (var i = 0; i < coreTests[index].tests.length; i++) {
      var test = coreTests[index].tests[i];
      it ("RENDER: " + test.message, render(test));
      it ("STREAM: " + test.message, stream(test));
      it ("PIPE: " + test.message, pipe(test));
    }
  };
});

function render(test) {
  return function() {
    try {
      dust.loadSource(dust.compile(test.source, test.name, test.strip));
      dust.render(test.name, test.context, function(err, output) {
        expect(err).toBeNull();
        expect(test.expected).toEqual(output);
      });
    }
    catch (error) {
      expect(test.error || {} ).toEqual(error.message);
    }
  };
}

function stream(test) {
  return function() {
    var output ="", flag;
    runs(function(){
      flag = false;
      output = "";
      try {
        dust.loadSource(dust.compile(test.source, test.name));
        dust.stream(test.name, test.context)
        .on("data", function(data) {
          output += data;
        })
        .on("end", function() {
          flag = true;
        })
        .on("error", function(err) {
          output = err.message;
        });
      } catch(error) {
        output = error.message;
        flag= true;
      }
    });
    
    waitsFor(function(){
      return flag;
    }, "the output", 500);
    
    runs(function(){
      if (test.error) {
        expect(test.error || {} ).toEqual(output);
      } else {
        expect(test.expected).toEqual(output);
      }
    });
  }
};

function pipe(test) {
  return function() {
    var output, outputTwo, flag, flagTwo;
    runs(function(){
      flag = false;
      flagTwo = false;
      output = "";
      outputTwo = "";
      try {
        dust.loadSource(dust.compile(test.source, test.name));
        var tpl = dust.stream(test.name, test.context);
        tpl.pipe({
          write: function (data) {
            output += data;
          },
          end: function () {
            flag = true;
          },
          error: function (err) {
            flag = true;
            output = err.message;
          }
        });
        // Pipe to a second stream to test multiple event-listeners
        tpl.pipe({
          write: function (data) {
            outputTwo += data;
          },
          end: function () {
            flagTwo = true;
          },
          error: function (err) {
            flagTwo = true;
            outputTwo = err.message;
          }
        });
      } catch(error) {
        output = error.message;
        outputTwo = error.message;
        flag= true;
        flagTwo= true;
      }
    });
    
    waitsFor(function(){
      return flag && flagTwo;
    }, "the output", 500);
    
    runs(function(){
      if (test.error) {
        expect(test.error || {} ).toEqual(output);
        expect(test.error || {} ).toEqual(outputTwo);
      } else {
        expect(test.expected).toEqual(output);
        expect(test.expected).toEqual(outputTwo);
      }
    });
  }
};

@@ -431,24 +431,41 @@
 unction() %7B%0A
+    var context;%0A
     try %7B%0A  
@@ -458,24 +458,24 @@
 ;%0A    try %7B%0A
-
       dust.l
@@ -531,24 +531,180 @@
 st.strip));%0A
+      dust.setOptions(test.options);%0A      context = test.context;%0A      if (test.base)%7B%0A         context = dust.makeBase(test.base).push(context);%0A      %7D%0A
       dust.r
@@ -716,29 +716,24 @@
 (test.name, 
-test.
 context, fun
@@ -1004,24 +1004,33 @@
 ut =%22%22, flag
+, context
 ;%0A    runs(f
@@ -1164,24 +1164,190 @@
       dust.s
+etOptions(test.options);%0A        context = test.context;%0A        if (test.base)%7B%0A           context = dust.makeBase(test.base).push(context);%0A        %7D%0A        dust.s
 tream(test.n
@@ -1343,37 +1343,32 @@
 ream(test.name, 
-test.
 context)%0A       
@@ -2015,24 +2015,33 @@
 lag, flagTwo
+, context
 ;%0A    runs(f
@@ -2202,32 +2202,198 @@
 e, test.name));%0A
+        context = test.context;%0A        if (test.base)%7B%0A           context = dust.makeBase(test.base).push(context);%0A        %7D%0A        dust.setOptions(test.options);%0A
         var tpl 
@@ -2417,21 +2417,16 @@
 t.name, 
-test.
 context)

Fix jasmine test runner to honor base and options properties