Initial Revision
[ohcount] / test / unit / d_test.rb
1 require File.dirname(__FILE__) + '/../test_helper'
2
3 class CTest < LingoTest
4
5         def test_comments
6                 lb = [Ohcount::LanguageBreakdown.new("dmd", "", "//comment", 0)]
7                 assert_equal lb, Ohcount::parse(" //comment", "dmd")
8         end
9
10         def test_empty_comments
11                 lb = [Ohcount::LanguageBreakdown.new("dmd", "","//\n", 0)]
12                 assert_equal lb, Ohcount::parse(" //\n", "dmd")
13         end
14
15         def test_strings
16                 lb = [Ohcount::LanguageBreakdown.new("dmd", "'/*' not a comment '*/'", "", 0)]
17                 assert_equal lb, Ohcount::parse("'/*' not a comment '*/'", "dmd")
18         end
19
20         def test_block_comment
21                 lb = [Ohcount::LanguageBreakdown.new("dmd", "","/*d*/", 0)]
22                 assert_equal lb, Ohcount::parse("/*d*/", "dmd")
23
24                 lb = [Ohcount::LanguageBreakdown.new("dmd", "","/+d+/", 0)]
25                 assert_equal lb, Ohcount::parse("/+d+/", "dmd")
26         end
27
28         def test_nested_block_comment
29                 lb = [Ohcount::LanguageBreakdown.new("dmd", "","/+ /*d*/ not_code(); +/", 0)]
30                 assert_equal lb, Ohcount::parse("/+ /*d*/ not_code(); +/", "dmd")
31         end
32
33         def test_comprehensive
34                 verify_parse("d1.d")
35         end
36
37 end