File: test_closure_compressor.rb

package info (click to toggle)
ruby-sprockets 4.2.1-4
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 2,964 kB
  • sloc: ruby: 13,014; javascript: 157; makefile: 4
file content (24 lines) | stat: -rw-r--r-- 585 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# frozen_string_literal: true
require 'minitest/autorun'
require 'sprockets/cache'
require 'sprockets/closure_compressor'

class TestClosureCompressor < Minitest::Test
  def test_compress_javascript
    input = {
      data: "function foo() {\n  return true;\n}",
      cache: Sprockets::Cache.new
    }
    output = "function foo(){return!0};\n"

    begin
      assert_equal output, Sprockets::ClosureCompressor.call(input)
    rescue Closure::Error
      skip "No Java runtime present"
    end
  end

  def test_cache_key
    assert Sprockets::ClosureCompressor.cache_key
  end
end