wordtree 0.3.0 → 0.3.1
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/wordtree/text_utils.rb +4 -1
- data/lib/wordtree/version.rb +1 -1
- data/spec/wordtree/text_utils_spec.rb +9 -0
- metadata +2 -2
data/lib/wordtree/text_utils.rb
CHANGED
data/lib/wordtree/version.rb
CHANGED
@@ -1,5 +1,6 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
require 'wordtree/text_utils'
|
3
|
+
require 'timeout'
|
3
4
|
|
4
5
|
describe WordTree::TextUtils do
|
5
6
|
context "#split_near" do
|
@@ -76,5 +77,13 @@ describe WordTree::TextUtils do
|
|
76
77
|
expect{ |b| WordTree::TextUtils.each_ngram(sample_text, 3, &b) }.to \
|
77
78
|
yield_successive_args("one word .", "word . two")
|
78
79
|
end
|
80
|
+
|
81
|
+
it "doesn't hang on unexpected input" do
|
82
|
+
sample_text = "one word\n. two \n"
|
83
|
+
Timeout.timeout(3) do
|
84
|
+
expect{ |b| WordTree::TextUtils.each_ngram(sample_text, 1, &b) }.to \
|
85
|
+
yield_successive_args("one", "word", ".", "two")
|
86
|
+
end
|
87
|
+
end
|
79
88
|
end
|
80
89
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: wordtree
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.1
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2014-09-
|
12
|
+
date: 2014-09-08 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: virtus
|