<commit_before>import 'jest-extended';
// @ts-ignore
import {
    toSafeString, unescapeString, escapeString, matchAll, match, formatRegex, FormatRegexResult
} from '../src';

describe('String Utils', () => {
    describe('toSafeString', () => {
        test.each([
            ['hello-there', 'hello-there'],
            ['++_--hello', 'hello'],
            ['Hello_Hi THERE', 'hello_hi_there'],
            ['Howdy-Hi?+ you', 'howdy-hi-you'],
            ['Hi there#*', 'hi-there'],
            ['<HI> 3', 'hi-3'],
            ['123', '123'],
            [123, '123'],
            [null, ''],
            // @ts-ignore
        ])('should convert %s to be %s', (input: any, expected: any) => {
            expect(toSafeString(input)).toEqual(expected);
        });
    });

    describe('escapeString', () => {
        test.each([
            ['hello', 'hello'],
            ['hello\\.', 'hello\\.'],
            ['hello.', 'hello\\.'],
            [' . ? ', '\\ \\.\\ \\?\\ '],
            ['\\\\.', '\\\\.'],
            ['\\ ', '\\ '],
            ['', ''],
        ])('should convert %j to %j', (input: string, expected: string) => {
            expect(escapeString(input, ['.', '?', ' '])).toEqual(expected);
        });
    });

    describe('unescapeString', () => {
        test.each([
            ['hello', 'hello'],
            ['hello\\.', 'hello.'],
            ['hello.', 'hello.'],
            [' . ? ', ' . ? '],<commit_msg>added tests to verify escaping behaviour<commit_after>import 'jest-extended';
// @ts-ignore
import {
    toSafeString, unescapeString, escapeString, matchAll, match, formatRegex, FormatRegexResult
} from '../src';

describe('String Utils', () => {
    describe('toSafeString', () => {
        test.each([
            ['hello-there', 'hello-there'],
            ['++_--hello', 'hello'],
            ['Hello_Hi THERE', 'hello_hi_there'],
            ['Howdy-Hi?+ you', 'howdy-hi-you'],
            ['Hi there#*', 'hi-there'],
            ['<HI> 3', 'hi-3'],
            ['123', '123'],
            [123, '123'],
            [null, ''],
            // @ts-ignore
        ])('should convert %s to be %s', (input: any, expected: any) => {
            expect(toSafeString(input)).toEqual(expected);
        });
    });

    describe('escapeString', () => {
        test.each([
            ['hello', 'hello'],
            ['hello\\.', 'hello\\.'],
            ['hello.', 'hello\\.'],
            [' . ? ', '\\ \\.\\ \\?\\ '],
            ['something-xy40\\" value 8008', 'something-xy40\\"\\ value\\ 8008'],
            ['\\\\.', '\\\\.'],
            ['\\ ', '\\ '],
            ['', ''],
        ])('should convert %j to %j', (input: string, expected: string) => {
            expect(escapeString(input, ['.', '?', ' ', "'", '"'])).toEqual(expected);
        });
    });

    describe('unescapeString', () => {
        test.each([
            ['hello', 'hello'],
            ['hello\\.', 'hello.'],
            ['hello.', 'hello.'],
            [' . ? ', ' . ? '],
{'fraction_non_alphanumeric': 0.2547515838612871, 'fraction_numerical': 0.013337779259753251, 'mean_word_length': 1.613240418118467, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 17, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5090298', 'n_tokens_mistral': 938, 'n_tokens_neox': 900, 'n_words': 165}