[feat] update
This commit is contained in:
parent
0dbb651a74
commit
f9eb20cfe9
@ -1,5 +1,5 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "node-rs-diff"
|
name = "rsdiff"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
authors = ["Jay <jay@trj.tw>"]
|
authors = ["Jay <jay@trj.tw>"]
|
||||||
edition = "2018"
|
edition = "2018"
|
||||||
@ -7,6 +7,7 @@ edition = "2018"
|
|||||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||||
|
|
||||||
[lib]
|
[lib]
|
||||||
|
name = "rsdiff"
|
||||||
crate-type = ["cdylib"]
|
crate-type = ["cdylib"]
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
|
@ -1,14 +1,25 @@
|
|||||||
const test = require('ava')
|
const test = require("ava");
|
||||||
|
|
||||||
const { diffChars } = require('../index')
|
const { diffChars, diffLines } = require("../index");
|
||||||
|
|
||||||
test('diff chars', (t) => {
|
test("diff chars", (t) => {
|
||||||
const left = 'asd'
|
const left = "asd";
|
||||||
const right = 'asd'
|
const right = "asd";
|
||||||
const result = diffChars(left, right)
|
const result = diffChars(left, right);
|
||||||
t.is(result.length, 1)
|
t.is(result.length, 1);
|
||||||
t.is(result[0].count, 3)
|
t.is(result[0].count, 3);
|
||||||
t.is(result[0].value, 'asd')
|
t.is(result[0].value, "asd");
|
||||||
t.is(result[0].added, false)
|
t.is(result[0].added, false);
|
||||||
t.is(result[0].removed, false)
|
t.is(result[0].removed, false);
|
||||||
})
|
});
|
||||||
|
|
||||||
|
test("diff lines", (t) => {
|
||||||
|
const left = "asd\ndsa";
|
||||||
|
const right = "asd\nddd\nvvv\n\na";
|
||||||
|
const result = diffLines(left, right);
|
||||||
|
|
||||||
|
t.is(result.length, 3);
|
||||||
|
t.is(result[0].count, 1);
|
||||||
|
t.is(result[1].count, 1);
|
||||||
|
t.is(result[2].count, 4);
|
||||||
|
});
|
||||||
|
@ -30,7 +30,7 @@
|
|||||||
"node": ">= 8.9"
|
"node": ">= 8.9"
|
||||||
},
|
},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"build": "cargo build --release && napi build --platform --release .",
|
"build": "cargo build --release && napi build --platform --release",
|
||||||
"build:debug": "cargo build && napi build --platform .",
|
"build:debug": "cargo build && napi build --platform .",
|
||||||
"test": "ava",
|
"test": "ava",
|
||||||
"publish:linux": "cross-env PLATFORM=linux node scripts/publish.js",
|
"publish:linux": "cross-env PLATFORM=linux node scripts/publish.js",
|
||||||
|
Loading…
Reference in New Issue
Block a user