blob: 2646e2f5a07885b17edace3c081322bf8ea13daa [file] [log] [blame]
Patrick Williams39653562024-03-01 08:54:02 -06001From 7a75d76c2d6bfb917f30ced8f5c0a9a4157f7819 Mon Sep 17 00:00:00 2001
2From: aekoroglu <ali.erdinc.koroglu@intel.com>
3Date: Fri, 24 Jun 2022 14:12:59 +0300
4Subject: [PATCH] DeprecationWarning invalid escape sequence fix
5
6Upstream-Status: Submitted [https://github.com/tikitu/jsmin/pull/38]
7Signed-off-by: Khem Raj <raj.khem@gmail.com>
8---
9 jsmin/test.py | 22 +++++++++++-----------
10 1 file changed, 11 insertions(+), 11 deletions(-)
11
12diff --git a/jsmin/test.py b/jsmin/test.py
13index 173ac65..afea4e7 100644
14--- a/jsmin/test.py
15+++ b/jsmin/test.py
16@@ -337,8 +337,8 @@ def testImplicitSemicolon3(self):
17 self.assertMinified("return//comment...\r\na", "return\na")
18
19 def testSingleComment2(self):
20- self.assertMinified('x.replace(/\//, "_")// slash to underscore',
21- 'x.replace(/\//,"_")')
22+ self.assertMinified('x.replace(/\\//, "_")// slash to underscore',
23+ 'x.replace(/\\//,"_")')
24
25 def testSlashesNearComments(self):
26 original = '''
27@@ -383,8 +383,8 @@ def test_space_in_regex(self):
28 self.assertMinified(original, original)
29
30 def test_brackets_around_slashed_regex(self):
31- original = 'function a() { /\//.test("a") }'
32- expected = 'function a(){/\//.test("a")}'
33+ original = 'function a() { /\\//.test("a") }'
34+ expected = 'function a(){/\\//.test("a")}'
35 self.assertMinified(original, expected)
36
37 def test_angular_1(self):
38@@ -455,12 +455,12 @@ def testBackticksTagged(self):
39 def test_issue_bitbucket_16(self):
40 original = """
41 f = function() {
42- return /DataTree\/(.*)\//.exec(this._url)[1];
43+ return /DataTree\\/(.*)\\//.exec(this._url)[1];
44 }
45 """
46 self.assertMinified(
47 original,
48- 'f=function(){return /DataTree\/(.*)\//.exec(this._url)[1];}')
49+ 'f=function(){return /DataTree\\/(.*)\\//.exec(this._url)[1];}')
50
51 def test_issue_bitbucket_17(self):
52 original = "// hi\n/^(get|post|head|put)$/i.test('POST')"
53@@ -470,7 +470,7 @@ def test_issue_bitbucket_17(self):
54 def test_issue_6(self):
55 original = '''
56 respond.regex = {
57- comments: /\/\*[^*]*\*+([^/][^*]*\*+)*\//gi,
58+ comments: /\\/\\*[^*]*\\*+([^/][^*]*\\*+)*\\//gi,
59 urls: 'whatever'
60 };
61 '''
62@@ -548,16 +548,16 @@ def test_issue_9_multi_comments(self):
63
64 def test_issue_12_re_nl_if(self):
65 original = '''
66- var re = /\d{4}/
67+ var re = /\\d{4}/
68 if (1) { console.log(2); }'''
69 self.assertMinified(
70- original, 'var re=/\d{4}/\nif(1){console.log(2);}')
71+ original, 'var re=/\\d{4}/\nif(1){console.log(2);}')
72
73 def test_issue_12_re_nl_other(self):
74 original = '''
75- var re = /\d{4}/
76+ var re = /\\d{4}/
77 g = 10'''
78- self.assertMinified(original , 'var re=/\d{4}/\ng=10')
79+ self.assertMinified(original , 'var re=/\\d{4}/\ng=10')
80
81 def test_preserve_copyright(self):
82 original = '''