Permalink
Browse files

Upgrade test runner to node v0.1.30.

  • Loading branch information...
1 parent 908480e commit 389c33c6e42f50e5dd7268c7a592bad67368cdbd @creationix committed Feb 25, 2010
Showing with 6 additions and 7 deletions.
  1. +1 −1 lib/haml.js
  2. +5 −6 test/test.js
View
@@ -1,7 +1,7 @@
var Haml = {};
// Bind to the exports object if it exists. (CommonJS and NodeJS)
-if (exports) {
+if (typeof exports !== 'undefined') {
Haml = exports;
}
View
@@ -1,11 +1,10 @@
-var file = require('file');
-var posix = require('posix');
+var fs = require('fs');
var assert = require('assert');
process.mixin(require('sys'));
var Haml = require("../lib/haml");
-posix.readdir('.').addCallback(function (files) {
+fs.readdir('.', function (err, files) {
files.forEach(function (haml_file) {
var m = haml_file.match(/^(.*)\.haml/),
base;
@@ -15,8 +14,8 @@ posix.readdir('.').addCallback(function (files) {
base = m[1];
function load_haml(scope) {
- file.read(haml_file).addCallback(function (haml) {
- file.read(base + ".html").addCallback(function (expected) {
+ fs.readFile(haml_file, function (err, haml) {
+ fs.readFile(base + ".html", function (err, expected) {
try {
var js = Haml.compile(haml);
var js_opt = Haml.optimize(js);
@@ -38,7 +37,7 @@ posix.readdir('.').addCallback(function (files) {
// Load scope
if (files.indexOf(base + ".js") >= 0) {
- file.read(base + ".js").addCallback(function (js) {
+ fs.readFile(base + ".js", function (err, js) {
load_haml(eval("(" + js + ")"));
});
} else {

0 comments on commit 389c33c

Please sign in to comment.