Browse files

[doc] Update README.md and add more examples for new functionality

  • Loading branch information...
1 parent d432c56 commit 34af14c865eaf39728a0bab476018e9f393a4742 @indexzero indexzero committed Aug 10, 2011
Showing with 79 additions and 8 deletions.
  1. +21 −8 README.md
  2. +18 −0 examples/ignoreCase.js
  3. +18 −0 examples/stripColors.js
  4. +22 −0 examples/wait.js
View
29 README.md
@@ -67,11 +67,24 @@ Lets take a look at some sample usage:
});
```
-# Authors
-[Elijah Insua][2] [Marak Squires][3], and [Charlie Robbins][4].
-
-[0]: http://search.cpan.org/~rgiersig/Expect-1.21/Expect.pod "expect"
-[1]: http://pexpect.sourceforge.net/pexpect.html "pexpect"
-[2]: http://github.com/tmpvar "Elijah Insua"
-[3]: http://github.com/marak "Marak Squires"
-[4]: http://github.com/indexzero "Charlie Robbins"
+If you are looking for more examples take a look at the [examples][2], and [tests][3].
+
+## Tests
+
+All tests are written with [vows][4]:
+
+``` bash
+ $ npm test
+```
+
+## Authors
+[Elijah Insua][5] [Marak Squires][6], and [Charlie Robbins][7].
+
+[0]: http://search.cpan.org/~rgiersig/Expect-1.21/Expect.pod
+[1]: http://pexpect.sourceforge.net/pexpect.html
+[2]: https://github.com/nodejitsu/nexpect/tree/master/examples
+[3]: https://github.com/nodejitsu/nexpect/tree/master/test/nexpect-test.js
+[4]: http://vowsjs.org
+[5]: http://github.com/tmpvar
+[6]: http://github.com/marak
+[7]: http://github.com/indexzero
View
18 examples/ignoreCase.js
@@ -0,0 +1,18 @@
+/*
+ * ignoreCase.js: Simple example for using the `ignoreCase` option with nexpect.
+ *
+ * (C) 2011, Elijah Insua, Marak Squires, Charlie Robbins.
+ *
+ */
+
+var path = require('path'),
+ nexpect = require('../lib/nexpect');
+
+nexpect.spawn(path.join(__dirname, '..', 'test', 'fixtures', 'multiple-cases'), { ignoreCase: true })
+ .wait('this has many cases')
+ .expect('this also has many cases')
+ .run(function (err) {
+ if (!err) {
+ console.log('multiple cases were waited and expected');
+ }
+ })
View
18 examples/stripColors.js
@@ -0,0 +1,18 @@
+/*
+ * stripColors.js: Simple example for using the `stripColors` option with nexpect.
+ *
+ * (C) 2011, Elijah Insua, Marak Squires, Charlie Robbins.
+ *
+ */
+
+var path = require('path'),
+ nexpect = require('../lib/nexpect');
+
+nexpect.spawn(path.join(__dirname, '..', 'test', 'fixtures', 'log-colors'), { stripColors: true })
+ .wait('second has colors')
+ .expect('third has colors')
+ .run(function (err) {
+ if (!err) {
+ console.log('colors were ignore, then waited and expected');
+ }
+ })
View
22 examples/wait.js
@@ -0,0 +1,22 @@
+/*
+ * wait.js: Simple example for using the `.wait()` method with nexpect.
+ *
+ * (C) 2011, Elijah Insua, Marak Squires, Charlie Robbins.
+ *
+ */
+
+var path = require('path'),
+ nexpect = require('../lib/nexpect');
+
+nexpect.spawn(path.join(__dirname, '..', 'test', 'fixtures', 'prompt-and-respond'), { stripColors: true })
+ .wait('first')
+ .sendline('first-prompt')
+ .expect('first-prompt')
+ .wait('second')
+ .sendline('second-prompt')
+ .expect('second-prompt')
+ .run(function (err) {
+ if (!err) {
+ console.log('two prompts were waited and responded to');
+ }
+ })

0 comments on commit 34af14c

Please sign in to comment.