'use strict';


var assert = require('assert');
var yaml   = require('../../');


test('RegExps should be properly closed', function () {
  assert.throws(function () { yaml.load('!!js/regexp /fo'); });
  assert.throws(function () { yaml.load('!!js/regexp /fo/q'); });
  assert.throws(function () { yaml.load('!!js/regexp /fo/giii'); });

  assert.equal(yaml.load('!!js/regexp /fo/g/g'), '/fo/g/g');
});

@@ -337,66 +337,454 @@
 %0A%0A  
-assert.equal(yaml.load('!!js/regexp /fo/g/g'), '/fo/g/g');
+// https://github.com/nodeca/js-yaml/issues/172%0A  var regexp = yaml.load('!!js/regexp /fo/g/g');%0A  assert.ok(regexp instanceof RegExp);%0A  var regexpStr = regexp.toString();%0A  // Accept the old (slightly incorrect) V8, as well as the new V8 result%0A  // TODO: Remove when/if Node 0.12 and below is no longer supported.%0A  if (regexpStr === '/fo/g/g') %7B%0A    assert.equal(regexpStr, '/fo/g/g');%0A  %7D else %7B%0A    assert.equal(regexpStr, '/fo%5C%5C/g/g');%0A  %7D
 %0A%7D);

Support new (correct) RegExp.toString behavior