TypeScript wed/util encodeDiff示例


typescript wed/util encodediff示例是从最受好评的开源项目中提取的实现代码,你可以参考下面示例的使用方式。

编程语言: TypeScript

命名空间/包名称: wed/util

文件: util-test.ts 项目: lddubeau/wed

    it("produces a diff for cases that are not as-is", () => {
      expect(util.encodeDiff("Abc", "abc")).to.equal("u1");
      expect(util.encodeDiff("abC", "abc")).to.equal("g2u1");
      expect(util.encodeDiff("abCdexFGh", "abcdexfgh"))

      // The treatment of "C" cannot be handled with the u operation because the
      // diff removes "abc" and then adds "C", and "abc" in uppercase is not
      // "C". The algorithm *could* be modified to handle this, but this is an a
      // case that won't actually happen with "real" data, and the few rare
      // cases that happens in languages other than English are not worth the
      // development expense.
      expect(util.encodeDiff("CdexFGh", "abcdexfgh"))

文件: util-test.ts 项目: lddubeau/wed

 it("produces an empty diff for as-is cases", () => {
   expect(util.encodeDiff("abc", "abc")).to.equal("");