Beispiel #1
0
        public void TestJsFileD()
        {
            string file = FilePath(d_simple_js_path);
            string min  = GoogleClosureCompiler.Compress(file, ClosureCompilerCompressMode.SIMPLE_OPTIMIZATIONS);

            Assert.AreEqual(d_min_js, min);
        }
Beispiel #2
0
        public void TestJsFileB()
        {
            string file = FilePath(b_whitespace_js_path);
            string min  = GoogleClosureCompiler.Compress(file, ClosureCompilerCompressMode.WHITESPACE_ONLY);

            Assert.AreEqual(min, b_min_js);
        }
Beispiel #3
0
 public void TestJSThrowGoogleErrorJS()
 {
     try
     {
         string min = GoogleClosureCompiler.Compress(FilePath(Error_chirp_js_path), ClosureCompilerCompressMode.WHITESPACE_ONLY);
     }
     catch (GoogleClosureCompilerErrorException eError)
     {
     }
     catch (Exception eError)
     {
         Assert.Fail("Wrong exception throw " + eError.GetType().ToString());
     }
 }
Beispiel #4
0
 public void TestJSFileNotFound()
 {
     try
     {
         GoogleClosureCompiler.Compress("w:\test.js", ClosureCompilerCompressMode.SIMPLE_OPTIMIZATIONS);
     }
     catch (FileNotFoundException eError)
     {
     }
     catch (Exception eError)
     {
         Assert.Fail("Wrong exception throw " + eError.GetType().ToString());
     }
 }
Beispiel #5
0
        public static string Minify(string fullFileName, string text, ProjectItem projectItem, ClosureCompilerCompressMode mode, string customArgument)
        {
            string returnedCode = null;

            returnedCode = GoogleClosureCompiler.Compress(
                fullFileName,
                text,
                mode,
                (category, msg, line, col) =>
            {
                if (TaskList.Instance == null)
                {
                    Console.WriteLine(string.Format("{0}({1},{2}){3}", fullFileName, line.ToString(), col.ToString(), msg));
                }
                else
                {
                    TaskList.Instance.Add(projectItem.ContainingProject, category, fullFileName, line, col, msg);
                }
            },
                customArgument
                );

            return(returnedCode);
        }