"use strict";

var assert = require("assert");
var File = require("vinyl");
var pegjs = require("./");

it("should generate a parser", function(cb) {
  var stream = pegjs();

  stream.on("data", function(file) {
    assert.equal(file.path, __dirname + "/fixture/fixture.js");
    assert.equal(file.relative, "fixture/fixture.js");
    assert(/Generated by PEG\.js/.test(file.contents.toString()));
    cb();
  });

  stream.write(
    new File({
      base: __dirname,
      path: __dirname + "/fixture/fixture.pegjs",
      contents: Buffer.from("start = ('a' / 'b')+")
    })
  );

  stream.end();
});

"use strict";

var assert = require("assert");
var path = require("path");
var File = require("vinyl");
var pegjs = require("./");

it("should generate a parser", function(cb) {
  var stream = pegjs();

  stream.on("data", function(file) {
    assert.equal(file.path, path.join(__dirname, "fixture/fixture.js"));
    assert.equal(file.relative, path.relative(__dirname, path.join(__dirname, "fixture/fixture.js")));
    assert(/Generated by PEG\.js/.test(file.contents.toString()));
    cb();
  });

  stream.write(
    new File({
      base: __dirname,
      path: path.join(__dirname, "fixture/fixture.pegjs"),
      contents: Buffer.from("start = ('a' / 'b')+")
    })
  );

  stream.end();
});

Use path instead of concatenation
Use path instead of concatenation
