Skip to content

Commit

Permalink
Add a test for quotes in cli args
Browse files Browse the repository at this point in the history
  • Loading branch information
goto-bus-stop committed Jan 9, 2020
1 parent 524ec54 commit 92e793a
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 0 deletions.
28 changes: 28 additions & 0 deletions test/cli.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
var fs = require("fs"),
test = require("tape"),
child_process = require("child_process"),
path = require("path"),
bin = require.resolve("../bin/replace");

function getText(file) {
var content = fs.readFileSync(file, "utf-8");
return content;
}

function join(file) {
return path.join(__dirname, file);
}

test('quotes parsing', function (t) {
t.plan(1);

var input = join("test_files/test_basic.txt");
var original = getText(input);
t.on("end", function () {
fs.writeFileSync(input, original, "utf-8");
});

child_process.spawnSync(process.execPath, [bin, "ac", "'single'", input]);

t.equal(getText(input), "aa'single'cc");
});
1 change: 1 addition & 0 deletions test/index.js
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
require('./cli')
require('./paths')
require('./sanity')

0 comments on commit 92e793a

Please sign in to comment.