@@ -76,6 +76,59 @@ describe('curl convert function', function () {
76
76
} ) ;
77
77
} ) ;
78
78
79
+ it ( 'should return snippet with backslash(\\) as line continuation ' +
80
+ 'character for multiline code generation by default' , function ( ) {
81
+ request = new sdk . Request ( {
82
+ 'method' : 'POST' ,
83
+ 'header' : [ ] ,
84
+ 'body' : {
85
+ 'mode' : 'raw' ,
86
+ 'raw' : ''
87
+ }
88
+ } ) ;
89
+ options = {
90
+ multiLine : true
91
+ } ;
92
+ convert ( request , options , function ( error , snippet ) {
93
+ if ( error ) {
94
+ expect . fail ( null , null , error ) ;
95
+ }
96
+ snippetArray = snippet . split ( '\n' ) ;
97
+ // Ignoring the last line as there is no line continuation character at last line
98
+ for ( var i = 0 ; i < snippetArray . length - 1 ; i ++ ) {
99
+ line = snippetArray [ i ] ;
100
+ expect ( line . charAt ( line . length - 1 ) ) . to . equal ( '\\' ) ;
101
+ }
102
+ } ) ;
103
+ } ) ;
104
+
105
+ it ( 'should return snippet with backtick(`) as line continuation ' +
106
+ 'character for multiline code generation' , function ( ) {
107
+ request = new sdk . Request ( {
108
+ 'method' : 'POST' ,
109
+ 'header' : [ ] ,
110
+ 'body' : {
111
+ 'mode' : 'raw' ,
112
+ 'raw' : ''
113
+ }
114
+ } ) ;
115
+ options = {
116
+ multiLine : true ,
117
+ lineContinuationCharacter : '`'
118
+ } ;
119
+ convert ( request , options , function ( error , snippet ) {
120
+ if ( error ) {
121
+ expect . fail ( null , null , error ) ;
122
+ }
123
+ snippetArray = snippet . split ( '\n' ) ;
124
+ // Ignoring the last line as there is no line continuation character at last line
125
+ for ( var i = 0 ; i < snippetArray . length - 1 ; i ++ ) {
126
+ line = snippetArray [ i ] ;
127
+ expect ( line . charAt ( line . length - 1 ) ) . to . equal ( '`' ) ;
128
+ }
129
+ } ) ;
130
+ } ) ;
131
+
79
132
it ( 'should parse header with string value properly' , function ( ) {
80
133
request = new sdk . Request ( {
81
134
'method' : 'POST' ,
0 commit comments