Sha256: b7744f6dc028daeefda61300f40aeb301f357b2cb1df814810beec09f6185176

Contents?: true

Size: 1.58 KB

Versions: 2

Compression:

Stored size: 1.58 KB

Contents

#! /usr/bin/env ruby
require File.dirname(__FILE__) + '/test_helper.rb'
require '_test-util'

class LicenseTest < Test::Unit::TestCase
  TestCases = [
    ["GPL1", false, "GNU General Public License version 1"],
    ["GPL2", false, "GNU General Public License version 2"],
    ["LGPL1", false, "GNU Library Public License version 1"],
    ["LGPL2", false, "GNU Library Public License version 2"],
    ["LGPL2.1", false, "GNU Lesser Public License version 2.1"],
    ["Other", false, "My own license version 999"],

    ["GPL2", false, "GNU GENERAL PUBLIC LICENSE VERSION 2"],
    ["GPL2", false, "GNU  GENERAL    PUBLIC    LICENSE VERSION  2"],
    ["GPL2", false, "GNU/GENERAL/PUBLIC/LICENSE/VERSION/2"],

    ["GPL2", false, '
# You can redistribute it and/or modify it under the terms of 
# the GNU General Public License version 2.
'
    ],

    ["GPL2", false, '
# You can redistribute it and/or modify it under the terms of 
# the GNU General Public License version 2.
#
# This is foobar version 1.  <= confusing!
'
    ],

    ["GPL2", true, '
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.'
    ],
  ]

  def test_license_detector
    TestCases.each {|abbrev, allow_later_p, text|
      detector = Gonzui::LicenseDetector.new(text)
      license = detector.detect
      assert_equal(abbrev, license.abbrev)
      assert_equal(allow_later_p, license.allow_later?)
    }
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
gonzui-1.2-x86-mswin32-60 test/test_license.rb
gonzui-1.2 test/test_license.rb