Permalink
Browse files

Merge pull request #57 from dervus/mocha

Port the tests to Mocha. And some of the missed PyYAML tests.
  • Loading branch information...
ixti committed Dec 20, 2012
2 parents fac1f14 + 499a5d6 commit ca5722ff181bde6323f0f62157990b1cca820a0d
Showing with 2,002 additions and 934 deletions.
  1. +3 −3 Makefile
  2. +10 −0 lib/js-yaml.js
  3. +1 −0 lib/js-yaml/reader.js
  4. +1 −1 package.json
  5. +0 −4 test/functional-test.js
  6. +14 −0 test/functional.js
  7. +36 −314 test/functional/canonical.js
  8. +31 −0 test/functional/constructor.js
  9. 0 test/{unported/data/construct-binary-py2.data → functional/data/construct-binary.data}
  10. +9 −0 test/functional/data/construct-binary.js
  11. +9 −0 test/functional/data/construct-bool.data
  12. +12 −0 test/functional/data/construct-bool.js
  13. 0 test/{unported → functional}/data/construct-custom.data
  14. +14 −0 test/functional/data/construct-custom.js
  15. 0 test/{unported → functional}/data/construct-float.data
  16. +10 −0 test/functional/data/construct-float.js
  17. 0 test/{unported → functional}/data/construct-int.data
  18. +10 −0 test/functional/data/construct-int.js
  19. +12 −0 test/functional/data/construct-javascript-function.data
  20. +44 −0 test/functional/data/construct-javascript-function.js
  21. +5 −0 test/functional/data/construct-javascript-regexp.data
  22. +10 −0 test/functional/data/construct-javascript-regexp.js
  23. +4 −0 test/functional/data/construct-javascript-undefined.data
  24. +9 −0 test/functional/data/construct-javascript-undefined.js
  25. +0 −7 test/functional/data/construct-map.code
  26. +15 −0 test/functional/data/construct-map.js
  27. 0 test/{unported → functional}/data/construct-merge.data
  28. +12 −0 test/functional/data/construct-merge.js
  29. 0 test/{unported → functional}/data/construct-null.data
  30. +20 −0 test/functional/data/construct-null.js
  31. 0 test/{unported → functional}/data/construct-omap.data
  32. +20 −0 test/functional/data/construct-omap.js
  33. 0 test/{unported → functional}/data/construct-pairs.data
  34. +14 −0 test/functional/data/construct-pairs.js
  35. 0 test/{unported → functional}/data/construct-seq.data
  36. +26 −0 test/functional/data/construct-seq.js
  37. 0 test/{unported → functional}/data/construct-set.data
  38. +14 −0 test/functional/data/construct-set.js
  39. 0 test/{unported → functional}/data/construct-str-ascii.data
  40. +3 −0 test/functional/data/construct-str-ascii.js
  41. 0 test/{unported/data/construct-str-utf8-py2.data → functional/data/construct-str-utf8.data}
  42. +3 −0 test/functional/data/construct-str-utf8.js
  43. 0 test/{unported → functional}/data/construct-str.data
  44. +5 −0 test/functional/data/construct-str.js
  45. 0 test/{unported → functional}/data/construct-timestamp.data
  46. +9 −0 test/functional/data/construct-timestamp.js
  47. 0 test/{unported → functional}/data/construct-value.data
  48. +16 −0 test/functional/data/construct-value.js
  49. 0 test/{unported/data/duplicate-key.former-loader-error.data → functional/data/duplicate-key.data}
  50. +3 −0 test/functional/data/duplicate-key.js
  51. 0 ...data/duplicate-mapping-key.former-loader-error.data → functional/data/duplicate-mapping-key.data}
  52. +8 −0 test/functional/data/duplicate-mapping-key.js
  53. 0 ...ted/data/duplicate-merge-key.former-loader-error.data → functional/data/duplicate-merge-key.data}
  54. +9 −0 test/functional/data/duplicate-merge-key.js
  55. 0 ...ted/data/duplicate-value-key.former-loader-error.data → functional/data/duplicate-value-key.data}
  56. +3 −0 test/functional/data/duplicate-value-key.js
  57. 0 ...nicode-character-bug-py2.data → functional/data/emitting-unacceptable-unicode-character-bug.data}
  58. +3 −0 test/functional/data/emitting-unacceptable-unicode-character-bug.js
  59. 0 ...haracter-bug-py2.skip-ext → functional/data/emitting-unacceptable-unicode-character-bug.skip-ext}
  60. 0 test/{unported → functional}/data/empty-document-bug.empty
  61. BIN test/{unported → functional}/data/invalid-character.stream-error
  62. 0 test/{unported → functional}/data/invalid-single-quote-bug.data
  63. +6 −0 test/functional/data/invalid-single-quote-bug.js
  64. 0 test/{unported → functional}/data/more-floats.data
  65. +11 −0 test/functional/data/more-floats.js
  66. 0 test/{unported → functional}/data/negative-float-bug.data
  67. +3 −0 test/functional/data/negative-float-bug.js
  68. 0 test/{unported → functional}/data/single-dot-is-not-float-bug.data
  69. +3 −0 test/functional/data/single-dot-is-not-float-bug.js
  70. 0 test/{unported → functional}/data/test_mark.marks
  71. 0 test/{unported → functional}/data/timestamp-bugs.data
  72. +10 −0 test/functional/data/timestamp-bugs.js
  73. 0 test/{unported → functional}/data/utf8-implicit.data
  74. +3 −0 test/functional/data/utf8-implicit.js
  75. 0 test/{unported → functional}/data/utf8.data
  76. +3 −0 test/functional/data/utf8.js
  77. +29 −0 test/functional/errors.js
  78. +0 −49 test/functional/functional-errors.js
  79. +0 −36 test/functional/functional-resolver.js
  80. +0 −80 test/functional/functional-structure.js
  81. +0 −84 test/functional/functional-tokens.js
  82. +45 −0 test/functional/mark.js
  83. +22 −0 test/functional/reader.js
  84. +28 −0 test/functional/resolver.js
  85. +75 −0 test/functional/structure.js
  86. +78 −0 test/functional/tokens.js
  87. +0 −84 test/helper.js
  88. +0 −4 test/issues-test.js
  89. +13 −0 test/issues.js
  90. +6 −10 test/issues/issue-17.js
  91. +7 −12 test/issues/issue-19.js
  92. +6 −10 test/issues/issue-26.js
  93. +13 −16 test/issues/issue-33.js
  94. +21 −26 test/issues/issue-46.js
  95. +19 −24 test/issues/issue-54.js
  96. +7 −12 test/issues/issue-8.js
  97. +1 −0 test/mocha.opts
  98. +30 −0 test/support/assert-paranoid-equal.js
  99. +16 −0 test/support/assert-paranoid-equal/context.js
  100. +117 −0 test/support/assert-paranoid-equal/inspectors.js
  101. +55 −0 test/support/assert-paranoid-equal/report.js
  102. +56 −0 test/support/assert-paranoid-equal/utilities.js
  103. +16 −0 test/support/canonical-error.js
  104. +28 −0 test/support/canonical-loader.js
  105. +187 −0 test/support/canonical-parser.js
  106. +373 −0 test/support/canonical-scanner.js
  107. +62 −0 test/support/classes.js
  108. +84 −0 test/support/common.js
  109. +74 −0 test/support/functional.js
  110. +7 −0 test/support/shims.js
  111. +29 −0 test/support/test-constructor.js
  112. +32 −0 test/support/test-loader.js
  113. +0 −7 test/unported/data/construct-binary-py2.code
  114. +0 −7 test/unported/data/construct-binary-py3.code
  115. +0 −12 test/unported/data/construct-binary-py3.data
  116. +0 −7 test/unported/data/construct-bool.code
  117. +0 −9 test/unported/data/construct-bool.data
  118. +0 −10 test/unported/data/construct-custom.code
  119. +0 −8 test/unported/data/construct-float.code
  120. +0 −8 test/unported/data/construct-int.code
  121. +0 −10 test/unported/data/construct-merge.code
  122. +0 −13 test/unported/data/construct-null.code
  123. +0 −8 test/unported/data/construct-omap.code
  124. +0 −9 test/unported/data/construct-pairs.code
  125. +0 −4 test/unported/data/construct-seq.code
  126. +0 −4 test/unported/data/construct-set.code
  127. +0 −1 test/unported/data/construct-str-ascii.code
  128. +0 −1 test/unported/data/construct-str-utf8-py2.code
  129. +0 −1 test/unported/data/construct-str-utf8-py3.code
  130. +0 −1 test/unported/data/construct-str-utf8-py3.data
  131. +0 −1 test/unported/data/construct-str.code
  132. +0 −7 test/unported/data/construct-timestamp.code
  133. +0 −9 test/unported/data/construct-value.code
  134. +0 −1 test/unported/data/duplicate-key.former-loader-error.code
  135. +0 −1 test/unported/data/duplicate-mapping-key.former-loader-error.code
  136. +0 −1 test/unported/data/duplicate-merge-key.former-loader-error.code
  137. +0 −1 test/unported/data/duplicate-value-key.former-loader-error.code
  138. +0 −1 test/unported/data/emitting-unacceptable-unicode-character-bug-py2.code
  139. +0 −1 test/unported/data/emitting-unacceptable-unicode-character-bug-py3.code
  140. +0 −1 test/unported/data/emitting-unacceptable-unicode-character-bug-py3.data
  141. 0 test/unported/data/emitting-unacceptable-unicode-character-bug-py3.skip-ext
  142. +0 −1 test/unported/data/invalid-single-quote-bug.code
  143. +0 −1 test/unported/data/more-floats.code
  144. +0 −1 test/unported/data/negative-float-bug.code
  145. +0 −1 test/unported/data/single-dot-is-not-float-bug.code
  146. +0 −8 test/unported/data/timestamp-bugs.code
  147. +0 −1 test/unported/data/utf8-implicit.code
  148. +0 −1 test/unported/data/utf8.code
  149. 0 test/unported/{data → unsupported}/construct-python-bool.code
  150. 0 test/unported/{data → unsupported}/construct-python-bool.data
  151. 0 test/unported/{data → unsupported}/construct-python-bytes-py3.code
  152. 0 test/unported/{data → unsupported}/construct-python-bytes-py3.data
  153. 0 test/unported/{data → unsupported}/construct-python-complex.code
  154. 0 test/unported/{data → unsupported}/construct-python-complex.data
  155. 0 test/unported/{data → unsupported}/construct-python-float.code
  156. 0 test/unported/{data → unsupported}/construct-python-float.data
  157. 0 test/unported/{data → unsupported}/construct-python-int.code
  158. 0 test/unported/{data → unsupported}/construct-python-int.data
  159. 0 test/unported/{data → unsupported}/construct-python-long-short-py2.code
  160. 0 test/unported/{data → unsupported}/construct-python-long-short-py2.data
  161. 0 test/unported/{data → unsupported}/construct-python-long-short-py3.code
  162. 0 test/unported/{data → unsupported}/construct-python-long-short-py3.data
  163. 0 test/unported/{data → unsupported}/construct-python-name-module.code
  164. 0 test/unported/{data → unsupported}/construct-python-name-module.data
  165. 0 test/unported/{data → unsupported}/construct-python-none.code
  166. 0 test/unported/{data → unsupported}/construct-python-none.data
  167. 0 test/unported/{data → unsupported}/construct-python-object.code
  168. 0 test/unported/{data → unsupported}/construct-python-object.data
  169. 0 test/unported/{data → unsupported}/construct-python-str-ascii.code
  170. 0 test/unported/{data → unsupported}/construct-python-str-ascii.data
  171. 0 test/unported/{data → unsupported}/construct-python-str-utf8-py2.code
  172. 0 test/unported/{data → unsupported}/construct-python-str-utf8-py2.data
  173. 0 test/unported/{data → unsupported}/construct-python-str-utf8-py3.code
  174. 0 test/unported/{data → unsupported}/construct-python-str-utf8-py3.data
  175. 0 test/unported/{data → unsupported}/construct-python-tuple-list-dict.code
  176. 0 test/unported/{data → unsupported}/construct-python-tuple-list-dict.data
  177. 0 test/unported/{data → unsupported}/construct-python-unicode-ascii-py2.code
  178. 0 test/unported/{data → unsupported}/construct-python-unicode-ascii-py2.data
  179. 0 test/unported/{data → unsupported}/construct-python-unicode-ascii-py3.code
  180. 0 test/unported/{data → unsupported}/construct-python-unicode-ascii-py3.data
  181. 0 test/unported/{data → unsupported}/construct-python-unicode-utf8-py2.code
  182. 0 test/unported/{data → unsupported}/construct-python-unicode-utf8-py2.data
  183. 0 test/unported/{data → unsupported}/construct-python-unicode-utf8-py3.code
  184. 0 test/unported/{data → unsupported}/construct-python-unicode-utf8-py3.data
  185. 0 test/unported/{data → unsupported}/float-representer-2.3-bug.code
  186. 0 test/unported/{data → unsupported}/float-representer-2.3-bug.data
  187. BIN test/unported/{data → unsupported}/odd-utf16.stream-error
  188. BIN test/unported/{data → unsupported}/spec-05-01-utf16be.data
  189. 0 test/unported/{data → unsupported}/spec-05-01-utf16be.empty
  190. BIN test/unported/{data → unsupported}/spec-05-01-utf16le.data
  191. 0 test/unported/{data → unsupported}/spec-05-01-utf16le.empty
  192. BIN test/unported/{data → unsupported}/spec-05-02-utf16be.data
  193. 0 test/unported/{data → unsupported}/spec-05-02-utf16be.error
  194. BIN test/unported/{data → unsupported}/spec-05-02-utf16le.data
  195. 0 test/unported/{data → unsupported}/spec-05-02-utf16le.error
  196. 0 test/unported/{data → unsupported}/utf16be.code
  197. BIN test/unported/{data → unsupported}/utf16be.data
  198. 0 test/unported/{data → unsupported}/utf16le.code
  199. BIN test/unported/{data → unsupported}/utf16le.data
View
@@ -33,12 +33,12 @@ lint:
test: lint
- @if test ! `which vows` ; then \
- echo "You need 'vows' installed in order to run tests." >&2 ; \
+ @if test ! `which mocha` ; then \
+ echo "You need 'mocha' installed in order to run tests." >&2 ; \
echo " $ make dev-deps" >&2 ; \
exit 128 ; \
fi
- NODE_ENV=test vows --spec
+ NODE_ENV=test mocha -R spec
doc:
View
@@ -23,6 +23,16 @@ jsyaml.scan = function scan(stream, callback, Loader) {
};
+jsyaml.parse = function parse(stream, callback, Loader) {
+ Loader = (Loader || _loader.SafeLoader);
+
+ var loader = new Loader(stream);
+ while (loader.checkEvent()) {
+ callback(loader.getEvent());
+ }
+};
+
+
jsyaml.compose = function compose(stream, Loader) {
Loader = (Loader || _loader.SafeLoader);
View
@@ -109,6 +109,7 @@ Reader.prototype.checkPrintable = function checkPrintable(data) {
module.exports.Reader = Reader;
+module.exports.ReaderError = ReaderError;
////////////////////////////////////////////////////////////////////////////////
View
@@ -24,6 +24,6 @@
"scripts" : { "test": "make test" },
"dependencies" : { "argparse": "~ 0.1.3" },
- "devDependencies" : { "vows": "~ 0.6.0" },
+ "devDependencies" : { "mocha": ">= 1.7.4" },
"engines" : { "node": ">= 0.6.0" }
}
View
@@ -1,4 +0,0 @@
-'use strict';
-require(__dirname + '/helper')
- .suite('Functional', __dirname + '/functional', new RegExp("^functional-.+?\\.js$"))
- .export(module);
View
@@ -0,0 +1,14 @@
+'use strict';
+/*global describe */
+
+
+describe('Functional.', function () {
+ require('./functional/reader');
+ require('./functional/mark');
+ require('./functional/tokens');
+ require('./functional/errors');
+ require('./functional/structure');
+ require('./functional/resolver');
+ require('./functional/constructor');
+ require('./functional/canonical');
+});
Oops, something went wrong.

0 comments on commit ca5722f

Please sign in to comment.