@@ -60,7 +60,7 @@ suite("SelectionInterpreter tests", () => {
6060 assert . equal ( rows [ 0 ] [ 5 ] , "" ) ;
6161 } ) ;
6262
63- test ( "allRows() doesn't consider \\| as separator " , ( ) => {
63+ test ( "allRows() doesn't consider \\| as separator" , ( ) => {
6464 const text = "h1|h2\\|still\\|h2\nv1|v2" ;
6565 const sut = createSut ( ) ;
6666
@@ -75,6 +75,43 @@ suite("SelectionInterpreter tests", () => {
7575 assert . equal ( rows [ 1 ] [ 1 ] , "v2" ) ;
7676 } ) ;
7777
78+ test ( "allRows() doesn't consider separator that's in a `code block` #1" , ( ) => {
79+ const text = "`h1|h2|h3`" ;
80+ const sut = createSut ( ) ;
81+
82+ const rows = sut . allRows ( text ) ;
83+
84+ assert . equal ( rows . length , 1 ) ;
85+ assert . equal ( rows [ 0 ] . length , 1 ) ;
86+ assert . equal ( rows [ 0 ] [ 0 ] , "`h1|h2|h3`" ) ;
87+ } ) ;
88+
89+ test ( "allRows() doesn't consider separator that's in a `code block` #2" , ( ) => {
90+ const text = "h1|h2`|still|h2`|h3" ;
91+ const sut = createSut ( ) ;
92+
93+ const rows = sut . allRows ( text ) ;
94+
95+ assert . equal ( rows . length , 1 ) ;
96+ assert . equal ( rows [ 0 ] . length , 3 ) ;
97+ assert . equal ( rows [ 0 ] [ 0 ] , "h1" ) ;
98+ assert . equal ( rows [ 0 ] [ 1 ] , "h2`|still|h2`" ) ;
99+ assert . equal ( rows [ 0 ] [ 2 ] , "h3" ) ;
100+ } ) ;
101+
102+ test ( "allRows() doesn't consider separator that's in a `code block` #3" , ( ) => {
103+ const text = "`h1|h1`|h2|h3`|h3`" ;
104+ const sut = createSut ( ) ;
105+
106+ const rows = sut . allRows ( text ) ;
107+
108+ assert . equal ( rows . length , 1 ) ;
109+ assert . equal ( rows [ 0 ] . length , 3 ) ;
110+ assert . equal ( rows [ 0 ] [ 0 ] , "`h1|h1`" ) ;
111+ assert . equal ( rows [ 0 ] [ 1 ] , "h2" ) ;
112+ assert . equal ( rows [ 0 ] [ 2 ] , "h3`|h3`" ) ;
113+ } ) ;
114+
78115 test ( "separator() returns the first row" , ( ) => {
79116 const text = "h1|h2\r\n:-|-\r\nv1|v2" ;
80117 const sut = createSut ( ) ;
0 commit comments