Permalink
Browse files

all the examples

  • Loading branch information...
substack committed Jul 7, 2012
1 parent eabab90 commit e65fe91c8448633bf3abcf3f88f814e53af23a2e
View
@@ -0,0 +1 @@
+module.exports = function (n) { return n * 100 };
View
@@ -0,0 +1,12 @@
+var falafel = require('falafel');
+var src = '(' + function () {
+ var x = 2 + 3 * 6;
+ var y = Math.pow(x, 2);
+ console.log(x + y);
+} + ')()';
+var out = falafel(src, function (node) {
+ if (node.type === 'CallExpression') {
+ node.update('fff(' + node.source() + ')');
+ }
+});
+console.log(out);
@@ -0,0 +1,12 @@
+var falafel = require('falafel');
+var src = '(' + function () {
+ var x = 2 + 3 * 6;
+ var y = Math.pow(x, 2);
+ console.log(x + y);
+} + ')()';
+var out = falafel(src, function (node) {
+ if (node.type === 'CallExpression') {
+ node.update('fff(' + node.source() + ')');
+ }
+});
+document.querySelector('pre').textContent = out;
View
@@ -0,0 +1,2 @@
+var bar = require('./bar');
+console.log(bar(5));
View
@@ -0,0 +1,4 @@
+var http = require('http');
+var ecstatic = require('ecstatic')(__dirname + '/static');
+http.createServer(ecstatic).listen(8085);
+console.log('http://localhost:8085');
@@ -0,0 +1,6 @@
+<html>
+<body>
+<pre></pre>
+</body>
+<script src="/bundle.js"></script>
+</html>
View
@@ -0,0 +1,23 @@
+var test = require('testling');
+
+test('submit a form', function (t) {
+ t.plan(1);
+
+ var uri = 'http://localhost:7272/test-form/';
+ var w = t.createWindow(uri, { t : t });
+
+ w.next(function (win, $) {
+ t.log('page[0]: ' + win.location.href);
+
+ var form = $('#form')[0];
+ $('input[name=login]').val('beep');
+ $('input[name=passw]').val('boop');
+ $('form').submit();
+ });
+
+ w.next(function (win, $) {
+ t.log('page[1]: ' + win.location.href);
+ t.equal($('#welcome p:first').text(), 'Login successful.');
+ t.end();
+ });
+});
@@ -0,0 +1 @@
+scriptreplay timefile
@@ -0,0 +1,58 @@
+0.765910 132
+0.683598 1
+0.925912 1
+0.057168 1
+0.090207 1
+0.111726 1
+0.096385 1
+0.048214 1
+0.058541 1
+0.053254 1
+0.122281 1
+0.105862 1
+0.074042 1
+0.107032 1
+0.089718 1
+0.127613 1
+0.095914 1
+0.126511 1
+0.122289 1
+0.143544 1
+0.194948 1
+0.085255 1
+0.207390 1
+0.143092 1
+0.161423 1
+0.250981 1
+0.094803 1
+0.073887 1
+0.074320 1
+0.632827 1
+0.067462 1
+0.082779 1
+0.106767 1
+0.100972 1
+0.041676 1
+0.063947 1
+0.074831 1
+0.116777 1
+0.133718 1
+0.111943 1
+0.106546 1
+0.143182 1
+0.079974 1
+0.063549 1
+0.197668 1
+0.127463 1
+0.058504 1
+0.116605 1
+0.223815 2
+0.300021 14
+7.174812 30
+0.131560 27
+0.002244 6
+0.003616 2
+0.000031 20
+0.000193 10
+0.000029 132
+0.010215 6
@@ -0,0 +1,15 @@
+Script started on Sat 30 Jun 2012 11:58:07 PM PDT
+]0;substack@beep: ~/projects/callback-to-the-future-nodeconf-2012/example/testlingsubstack : testling $ testling test.js --browser=testling.chrome/12.0
+>> beep boop
+TAP version 13
+# json parse
+ok 1 should be equivalent
+
+1..1
+# tests 1
+# pass 1
+
+# ok
+]0;substack@beep: ~/projects/callback-to-the-future-nodeconf-2012/example/testlingsubstack : testling $ exit
+
+Script done on Sat 30 Jun 2012 11:58:24 PM PDT
@@ -0,0 +1,3 @@
+#!/bin/bash
+kill $(ps aux|grep chrome|grep -- --proxy|perl -nle'print $1 if /^\S+\s+(\d+)/')
+node /home/substack/projects/schoolbus/example/form/server.js
View
@@ -0,0 +1,7 @@
+var test = require('testling');
+
+test('json parse', function (t) {
+ t.same(JSON.parse('[1,2]'), [1,2]);
+ t.log('beep boop');
+ t.end();
+});

0 comments on commit e65fe91

Please sign in to comment.