@@ -2,43 +2,43 @@ import { describe, expect, it } from "../test_helpers/mocha.ts";
2
2
import { escapeChar , escapeForWithinString , getStringFromStrOrFunc } from "./string_utils.ts" ;
3
3
4
4
describe ( "escapeForWithinString" , ( ) => {
5
- function doTest ( input : string , expected : string ) {
6
- expect ( escapeForWithinString ( input , "\"" ) ) . to . equal ( expected ) ;
7
- }
5
+ function doTest ( input : string , expected : string ) {
6
+ expect ( escapeForWithinString ( input , "\"" ) ) . to . equal ( expected ) ;
7
+ }
8
8
9
- it ( "should escape the quotes and newline" , ( ) => {
10
- doTest ( `"testing\n this out"` , `\\"testing\\\n this out\\"` ) ;
11
- } ) ;
9
+ it ( "should escape the quotes and newline" , ( ) => {
10
+ doTest ( `"testing\n this out"` , `\\"testing\\\n this out\\"` ) ;
11
+ } ) ;
12
12
} ) ;
13
13
14
14
describe ( "escapeChar" , ( ) => {
15
- function doTest ( input : string , char : string , expected : string ) {
16
- expect ( escapeChar ( input , char ) ) . to . equal ( expected ) ;
17
- }
15
+ function doTest ( input : string , char : string , expected : string ) {
16
+ expect ( escapeChar ( input , char ) ) . to . equal ( expected ) ;
17
+ }
18
18
19
- it ( "should throw when specifying a char length > 1" , ( ) => {
20
- expect ( ( ) => escapeChar ( "" , "ab" ) ) . to . throw ( ) ;
21
- } ) ;
19
+ it ( "should throw when specifying a char length > 1" , ( ) => {
20
+ expect ( ( ) => escapeChar ( "" , "ab" ) ) . to . throw ( ) ;
21
+ } ) ;
22
22
23
- it ( "should throw when specifying a char length < 1" , ( ) => {
24
- expect ( ( ) => escapeChar ( "" , "" ) ) . to . throw ( ) ;
25
- } ) ;
23
+ it ( "should throw when specifying a char length < 1" , ( ) => {
24
+ expect ( ( ) => escapeChar ( "" , "" ) ) . to . throw ( ) ;
25
+ } ) ;
26
26
27
- it ( "should escape the single quotes when specified" , ( ) => {
28
- doTest ( `'testing "this" out'` , `'` , `\\'testing "this" out\\'` ) ;
29
- } ) ;
27
+ it ( "should escape the single quotes when specified" , ( ) => {
28
+ doTest ( `'testing "this" out'` , `'` , `\\'testing "this" out\\'` ) ;
29
+ } ) ;
30
30
31
- it ( "should escape regardless of if the character is already escaped" , ( ) => {
32
- doTest ( `"testing \\"this\\" out"` , `"` , `\\"testing \\\\"this\\\\" out\\"` ) ;
33
- } ) ;
31
+ it ( "should escape regardless of if the character is already escaped" , ( ) => {
32
+ doTest ( `"testing \\"this\\" out"` , `"` , `\\"testing \\\\"this\\\\" out\\"` ) ;
33
+ } ) ;
34
34
} ) ;
35
35
36
36
describe ( "getStringFromStrOrFunc" , ( ) => {
37
- it ( "should return a string when given a string" , ( ) => {
38
- expect ( getStringFromStrOrFunc ( "test" ) ) . to . equal ( "test" ) ;
39
- } ) ;
37
+ it ( "should return a string when given a string" , ( ) => {
38
+ expect ( getStringFromStrOrFunc ( "test" ) ) . to . equal ( "test" ) ;
39
+ } ) ;
40
40
41
- it ( "should return a string when given a function" , ( ) => {
42
- expect ( getStringFromStrOrFunc ( ( ) => "test" ) ) . to . equal ( "test" ) ;
43
- } ) ;
41
+ it ( "should return a string when given a function" , ( ) => {
42
+ expect ( getStringFromStrOrFunc ( ( ) => "test" ) ) . to . equal ( "test" ) ;
43
+ } ) ;
44
44
} ) ;
0 commit comments