@@ -43,6 +43,59 @@ suite('lineSeparator option', function () {
43
43
lineSeparatorTest ( 'CRLF' , { lineSeparator : '\r\n' } , '\r\n' ) ;
44
44
} ) ;
45
45
46
+
47
+ suite ( 'outputOffset option' , function ( ) {
48
+ function outputOffsetCustomizationTest ( option , expectedLines ) {
49
+ var assert = empower ( baseAssert , createFormatter ( option ) ) ;
50
+ test ( JSON . stringify ( option ) , function ( ) {
51
+ var hoge = 'foo' ;
52
+ var fuga = 'bar' ;
53
+ try {
54
+ eval ( weave ( 'assert.ok(hoge === fuga, "comment");' ) ) ;
55
+ } catch ( e ) {
56
+ baseAssert . equal ( e . name , 'AssertionError' ) ;
57
+ var actual = e . message . split ( createFormatter . defaultOptions ( ) . lineSeparator ) ;
58
+ baseAssert . deepEqual ( actual , expectedLines ) ;
59
+ }
60
+ } ) ;
61
+ }
62
+ outputOffsetCustomizationTest ( { outputOffset : 1 } , [
63
+ 'comment # /path/to/some_test.js:1' ,
64
+ ' ' ,
65
+ ' assert.ok(hoge === fuga, "comment")' ,
66
+ ' | | | ' ,
67
+ ' | | "bar" ' ,
68
+ ' | false ' ,
69
+ ' "foo" ' ,
70
+ ' ' ,
71
+ ' --- [string] fuga' ,
72
+ ' +++ [string] hoge' ,
73
+ ' @@ -1,3 +1,3 @@' ,
74
+ ' -bar' ,
75
+ ' +foo' ,
76
+ ' ' ,
77
+ ' '
78
+ ] ) ;
79
+ outputOffsetCustomizationTest ( { outputOffset : 3 } , [
80
+ 'comment # /path/to/some_test.js:1' ,
81
+ ' ' ,
82
+ ' assert.ok(hoge === fuga, "comment")' ,
83
+ ' | | | ' ,
84
+ ' | | "bar" ' ,
85
+ ' | false ' ,
86
+ ' "foo" ' ,
87
+ ' ' ,
88
+ ' --- [string] fuga' ,
89
+ ' +++ [string] hoge' ,
90
+ ' @@ -1,3 +1,3 @@' ,
91
+ ' -bar' ,
92
+ ' +foo' ,
93
+ ' ' ,
94
+ ' '
95
+ ] ) ;
96
+ } ) ;
97
+
98
+
46
99
suite ( 'renderers customization' , function ( ) {
47
100
function rendererCustomizationTest ( name , option , expectedLines ) {
48
101
var assert = empower ( baseAssert , createFormatter ( option ) ) ;
0 commit comments