You can not select more than 25 topics
			Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
		
		
		
		
		
			
		
			
				
					
					
						
							36 lines
						
					
					
						
							1.0 KiB
						
					
					
				
			
		
		
		
			
			
			
		
		
	
	
							36 lines
						
					
					
						
							1.0 KiB
						
					
					
				
								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();
							 | 
						|
								};
							 | 
						|
								
							 |