Sha256: a56a89e292dccf3de4c3ee3d0fee90db4b444f99b2d0fbdb2ff250c9ca54f594

Contents?: true

Size: 1 KB

Versions: 2

Compression:

Stored size: 1 KB

Contents

# -*- coding: utf-8 -*-
#
# @file 
# @brief
# @author ongaeshi
# @date   2012/09/29

require 'milkode/common/plang_detector'
require 'test_helper'

module Milkode
  class TestPlangDetector < Test::Unit::TestCase
    def test_name
      assert_equal 'ActionScript', PlangDetector.new('Dummy.as').name
      assert_equal 'C'           , PlangDetector.new('a.c').name
      assert_equal 'C'           , PlangDetector.new('a.h').name
      assert_equal 'C#'          , PlangDetector.new('AssemblyInfo.cs').name
      assert_equal 'C++'         , PlangDetector.new('path/to/file.hpp').name
      assert_equal 'Ruby'        , PlangDetector.new('template.rb').name
      assert_equal 'README'      , PlangDetector.new('readme.txt').name
      assert_equal 'JavaScript'  , PlangDetector.new('main.js').name
    end

    def test_unknown
      assert_equal 'unknown', PlangDetector.new('').name
      assert_equal 'unknown', PlangDetector.new('.').name
      assert_equal 'unknown', PlangDetector.new('abcdefg').name
    end
  end
end


Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
milkode-0.9.3.1 test/test_plang_detector.rb
milkode-0.9.3 test/test_plang_detector.rb