All new
alle new
This commit is contained in:
1 parent
da64472251
commit
5b20adee48
1605 files changed
+396517
-1674
No files matched your search
+36
@@ -0,0 +1,36 @@
|
||||
var errors = require("../lib/errors");
|
||||
var StringSource = require("../lib/StringSource");
|
||||
|
||||
exports.errorDescriptionIncludesLocationAndActualValueAndExpectedValue = function(test) {
|
||||
var error = errors.error({
|
||||
expected: "Nothing",
|
||||
actual: "Something",
|
||||
location: {
|
||||
describe: function() {
|
||||
return "Here"
|
||||
}
|
||||
}
|
||||
});
|
||||
test.equal("Here:\nExpected Nothing\nbut got Something", error.describe());
|
||||
test.done();
|
||||
};
|
||||
|
||||
exports.canDescribeErrorWithoutLocation = function(test) {
|
||||
var error = errors.error({
|
||||
expected: "Nothing",
|
||||
actual: "Something"
|
||||
});
|
||||
test.equal("Expected Nothing\nbut got Something", error.describe());
|
||||
test.done();
|
||||
};
|
||||
|
||||
exports.canGetPositionFromError = function(test) {
|
||||
var error = errors.error({
|
||||
expected: "Nothing",
|
||||
actual: "Something",
|
||||
location: new StringSource("abc\ndef\nghi\n", "").range(6, 8)
|
||||
});
|
||||
test.equal(2, error.lineNumber());
|
||||
test.equal(3, error.characterNumber());
|
||||
test.done();
|
||||
};
|
||||
Reference in new issue
Block a user