Detalhes do pacote

unexpected-function-equality

unexpectedjs26BSD-3-Clause3.1.0

Determine function equivalence by pretty-printing, then comparing the strings

Unexpected, AST, esprima, function

readme (leia-me)

unexpected-function-equality

NPM version Build Status Coverage Status Dependency Status

Unexpected function(al) equality :)

Plugin for Unexpected 10+ that overrides the <function> to equal <function> assertion with an implementation that disregards whitespace. This is accomplished by parsing and pretty-printing the functions, then doing a string comparison.

Example:

var expect = require('unexpected')
  .clone()
  .use(require('unexpected-function-equality'));

it('should consider the two functions equal', function () {
  expect(
    function (a) {
      return 123 - 456;
    },
    'to equal',
    function (a) {
      return 123 - 456;
    }
  );
});

This is handy when testing code that generates code.

Releases

Changelog

License

Unexpected-function-equality is licensed under a standard 3-clause BSD license -- see the LICENSE file for details.

changelog (log de mudanças)

v3.1.0 (2020-11-22)

Pull requests

Commits to master

v3.0.0 (2020-06-28)

Pull requests

Commits to master

v2.0.1 (2019-01-20)

Pull requests

Commits to master

v2.0.0 (2018-06-24)

Pull requests

Commits to master

v1.0.1 (2015-10-09)

v1.0.0