mirror of
https://github.com/clusterio/clusterio.git
synced 2026-11-11 23:04:52 +09:00
Split up codebase into the packages @clsterio/lib, @clusterio/master, @clusterio/slave, and @clusterio/ctl using lerna to manage them. This will allow deployment to use only the parts needed reducing install size, and better separate the code into shared library, master, slave and control.
32 lines
1010 B
JavaScript
32 lines
1010 B
JavaScript
"use strict";
|
|
const assert = require("assert").strict;
|
|
|
|
const luaTools = require("@clusterio/lib/luaTools");
|
|
|
|
|
|
describe("lib/luaTools", function() {
|
|
describe("escapeString()", function() {
|
|
it("should escape backslashes", function() {
|
|
assert.equal(luaTools.escapeString("\\a"), "\\\\a");
|
|
});
|
|
it("should escape double quotes", function() {
|
|
assert.equal(luaTools.escapeString('"a"'), '\\"a\\"');
|
|
});
|
|
it("should escape single quotes", function() {
|
|
assert.equal(luaTools.escapeString("'a'"), "\\'a\\'");
|
|
});
|
|
it("should escape nul bytes", function() {
|
|
assert.equal(luaTools.escapeString("a\0b"), "a\\0b");
|
|
});
|
|
it("should escape newlines", function() {
|
|
assert.equal(luaTools.escapeString("a\nb"), "a\\nb");
|
|
});
|
|
it("should escape carriage return", function() {
|
|
assert.equal(luaTools.escapeString("a\rb"), "a\\rb");
|
|
});
|
|
it("should escape all combined", function() {
|
|
assert.equal(luaTools.escapeString("a\\b\"c'd\0e\nf\rg"), "a\\\\b\\\"c\\'d\\0e\\nf\\rg");
|
|
});
|
|
});
|
|
});
|