mirror of
https://github.com/klzgrad/naiveproxy.git
synced 2024-12-01 01:36:09 +03:00
31 lines
837 B
Python
Executable File
31 lines
837 B
Python
Executable File
#!/usr/bin/env python3
|
|
# Copyright 2021 The Chromium Authors. All rights reserved.
|
|
# Use of this source code is governed by a BSD-style license that can be
|
|
# found in the LICENSE file.
|
|
|
|
import unittest
|
|
|
|
import minify_with_uglify
|
|
|
|
|
|
class MinifyWithUglifyTest(unittest.TestCase):
|
|
def test_simple(self):
|
|
source = """
|
|
var foo = 0;
|
|
"""
|
|
minimized = minify_with_uglify.Minify(source)
|
|
self.assertEquals(minimized, "var foo=0;")
|
|
|
|
def test_complex(self):
|
|
source = """
|
|
// comments should be removed
|
|
var foo = {
|
|
"bar": 0,
|
|
baz: 5,
|
|
};
|
|
var qux = foo.bar + foo.baz;
|
|
"""
|
|
minimized = minify_with_uglify.Minify(source)
|
|
self.assertEquals(minimized,
|
|
"var foo={bar:0,baz:5};var qux=foo.bar+foo.baz;")
|