Exemple #1
0
    def testCantRemoveFakeMultilineCommentsInsideStrings(self):
        input = """
function() {
    var a = "/*asdf*/";
    }
"""
        output = minifyme.remove_multiline_comments(input)
        self.assertTrue(output.find('"/*asdf*/"') > 0)
Exemple #2
0
    def testRemovingMultilineComments(self):
        input = """
/*
    A mind once  
    stretched by a new idea
    never returns to its
    original dimension
*/
    var a = 1;
"""
        output = minifyme.remove_multiline_comments(input)    
        self.assertTrue(output.find("mind") < 0)
        self.assertTrue(output.find("dimension") < 0)
        self.assertTrue(output.find("var") > 0)
Exemple #3
0
    def test_removing_multiline_comments(self):
        input = r'''
	/*
	    A mind once  
	    stretched by a new idea
	    never returns to its
	    original dimension
	*/
	    var a = 1;
	'''
        output = minifyme.remove_multiline_comments(input)    
        self.assertTrue(output.find(r'mind') < 0)
        self.assertTrue(output.find(r'dimension') < 0)
        self.assertTrue(output.find(r'/*') < 0)
        self.assertTrue(output.find(r'*/') < 0)
        self.assertTrue(output.find(r'var') > 0)
Exemple #4
0
 def test_cant_remove_line_comment_when_removing_multiline_comments(self):
     input = r'// /*asdf' 
     output = minifyme.remove_multiline_comments(input)
     self.assertTrue(output.find(r'// /*asdf') >= 0)
Exemple #5
0
 def test_cant_remove_fake_multiline_comments_inside_regex(self):
     input = r'var a = /\/*asdf*\//;'
     output = minifyme.remove_multiline_comments(input)
     self.assertTrue(output.find(r'/*asdf*\/') > 0)
Exemple #6
0
 def test_cant_remove_fake_multiline_comments_inside_strings(self):
     input = r'var a = "/*asdf*/";'
     output = minifyme.remove_multiline_comments(input)
     self.assertTrue(output.find(r'"/*asdf*/"') > 0)