Permalink
Browse files

added test

  • Loading branch information...
1 parent ad7862a commit bb3faf97091425ddbec0b2fbcaac2305b98e08c8 @chinghanho committed Mar 24, 2013
Showing with 38 additions and 0 deletions.
  1. +2 −0 test/test_helper.rb
  2. +36 −0 test/test_moretext.rb
View
@@ -0,0 +1,2 @@
+require "test/unit"
+require File.expand_path(File.dirname(__FILE__) + '/../lib/chh_moretext')
View
@@ -0,0 +1,36 @@
+require File.expand_path(File.dirname(__FILE__) + '/test_helper.rb')
+
+module ChhMoretext
+ class Base
+ class << self
+ WORD = ""
+
+ def fetch_moretext(number, limit)
+ limit = 1 unless limit != nil
+ [WORD * limit] * number
+ end
+ end
+ end
+end
+
+class TestMoretext < Test::Unit::TestCase
+ def setup
+ @tester = ChhMoretext::Moretext
+ end
+
+ def test_sentence
+ assert @tester.sentence(5) == ["測測測測測"]
+ end
+
+ def test_sentences
+ assert @tester.sentences(2, 5) == "測測測測測測測測測測"
+ end
+
+ def test_paragraph
+ assert @tester.paragraph(5) == "測測測測測"
+ end
+
+ def test_paragraphs
+ assert @tester.paragraphs(3) == "測測測\r\n\r\n測測測\r\n\r\n測測測"
+ end
+end

0 comments on commit bb3faf9

Please sign in to comment.