Permalink
Browse files

テスト追加

  • Loading branch information...
1 parent fc0549f commit 70afa6bd1274b6445d2fce36b69f37643e587f2b @masui committed Apr 30, 2012
Showing with 31 additions and 6 deletions.
  1. +31 −6 test/test_re_expand.rb
@@ -1,11 +1,36 @@
+# -*- coding: utf-8 -*-
require File.dirname(__FILE__) + '/test_helper.rb'
-class TestReExpand < Test::Unit::TestCase
+module ReExpand
+ class TestReExpand < Test::Unit::TestCase
+
+ def setup
+ end
+
+ def test_truth
+ assert true
+ end
+
+ def test_array
+ e = "(月|火|水|木|金)曜(1|2|3|4|5|6)限".expand
+ assert_equal e.class, Array
+ assert_equal e.length, 30
+ end
+
+ def test_2
+ "(月|火|水|木|金)曜(1|2|3|4|5|6)限".expand { |s,a|
+ assert_equal a.length, 2
+ }
+
+ e = "(月|火|水|木|金)曜(1|2|3|4|5|6)限".expand(' 1 ')
+ assert_equal e.length, 5
+
+ '(ab|cd)*'.expand(/bc/){ |s,a|
+ assert_equal a.length, 1
+ assert s =~ /abcd/
+ }
+
+ end
- def setup
- end
-
- def test_truth
- assert true
end
end

0 comments on commit 70afa6b

Please sign in to comment.