spec/jldrill/model/Tanaka_spec.rb in jldrill-0.5.1.7 vs spec/jldrill/model/Tanaka_spec.rb in jldrill-0.6.0.1

- old
+ new

@@ -1,6 +1,6 @@ -# -*- coding: utf-8 -*- +# encoding: utf-8 require 'jldrill/model/Tanaka' require 'jldrill/model/Config' module JLDrill::Tanaka describe Reference do @@ -21,18 +21,18 @@ tanaka.numWords.should be(3) sentences = tanaka.search("です", nil) sentences.should_not be_nil sentences.should_not be_empty sentences.size.should be(1) - sentences[0].to_s.should eql("203: です\n\tなんですか?\n\tWhat is it?") + sentences[0].to_s.should eql("です\n\t203: なんですか?\n\tWhat is it?") sentences = tanaka.search("Fail", nil) sentences.should_not be_nil sentences.should be_empty sentences = tanaka.search("何", "なに") sentences.should_not be_empty sentences.size.should be(1) - sentences[0].to_s.should eql("203: 何{なん}\n\tなんですか?\n\tWhat is it?") + sentences[0].to_s.should eql("何\n\t203: なんですか?\n\tWhat is it?") end it "should be able to parse Words" do phrase= "this(is)[1]{fun}~" m = Reference::WORD_RE.match(phrase) @@ -68,14 +68,13 @@ tanaka.parseLines(a, b, 0) tanaka.numSentences.should eql(1) tanaka.numWords.should eql(3) " 如何(どう)".start_with?(" 如何(どう)").should be_true s = tanaka.search("如何", "どう") - s[0].to_s.should eql("203: 如何(どう)[1]{どう}~\n\tどう為るの?\n\tWhat are you going to do?") - s[0].english.should eql("What are you going to do?") - s[0].japanese.should eql("どう為るの?") - s[0].id.should eql(203) + s[0].to_s.should eql("如何(どう)[1]~\n\t203: どう為るの?\n\tWhat are you going to do?") + s[0].nativeLanguage.should eql("What are you going to do?") + s[0].targetLanguage.should eql("203: どう為るの?") end it "should be able to parse multiple entries" do file = %Q[A: &という記号は、andを指す。 The sign '&' stands for 'and'.#ID=1 B: と言う{という}~ 記号~ は を 指す[03]~ @@ -125,9 +124,10 @@ tanaka = Reference.new tanaka.lines.size.should be(0) tanaka.file = (File.join(JLDrill::Config::DATA_DIR, "tests/examples.utf")) tanaka.readLines + tanaka.encoding.should eql(Kconv::UTF8) tanaka.lines.size.should be(200) # Not EOF yet tanaka.parseChunk(20).should eql(false) tanaka.fraction.should eql(0.10) tanaka.parseChunk(20).should eql(false)