'use strict';

var test = require('tape');

var isError = require('../index.js');

test('isError is a function', function t(assert) {
    assert.equal(typeof isError, 'function');
    assert.end();
});

test('returns true for error', function t(assert) {
    assert.equal(isError(new Error('foo')), true);
    assert.equal(isError(Error('foo')), true);
    assert.end();
});

test('returns false for non-error', function t(assert) {
    assert.equal(isError(null), false);
    assert.equal(isError(undefined), false);
    assert.equal(isError({message: 'hi'}), false);
    assert.end();
});

@@ -35,16 +35,40 @@
 'tape');
+%0Avar vm = require('vm');
 %0A%0Avar is
@@ -588,28 +588,573 @@
 lse);%0A    assert.end();%0A%7D);%0A
+%0Atest('errors that inherit from Error', function t(assert) %7B%0A    var error = Object.create(new Error());%0A    assert.equal(isError(error), true);%0A    assert.end();%0A%7D);%0A%0Atest('errors from other contexts', function t(assert) %7B%0A    var error = vm.runInNewContext('new Error()');%0A    assert.equal(isError(error), true);%0A    assert.end();%0A%7D);%0A%0Atest('errors that inherit from Error in another context', function t(assert) %7B%0A    var error = vm.runInNewContext('Object.create(new Error())');%0A    assert.equal(isError(error), true);%0A    assert.end();%0A%7D);%0A

Add breaking tests for foreign/inherited errors