expectr 0.5.0 → 0.5.1
Sign up to get free protection for your applications and to get access to all the features.
- data/Rakefile +2 -2
- data/VERSION +1 -1
- data/expectr.gemspec +58 -0
- data/lib/expectr.rb +17 -0
- data/test/test_expectr.rb +18 -16
- metadata +14 -13
data/Rakefile
CHANGED
@@ -17,8 +17,8 @@ Jeweler::Tasks.new do |gem|
|
|
17
17
|
gem.homepage = "http://github.com/cwuest/expectr"
|
18
18
|
gem.license = "MIT"
|
19
19
|
gem.summary = %Q{Expect for Ruby}
|
20
|
-
gem.description = %Q{Implementation of NIST Expect in Ruby,
|
21
|
-
gem.email = "chris
|
20
|
+
gem.description = %Q{Implementation of functionality from NIST Expect in Ruby, with an emphasis on control and extensibility}
|
21
|
+
gem.email = "chris@chriswuest.com"
|
22
22
|
gem.authors = ["Chris Wuest"]
|
23
23
|
# dependencies defined in Gemfile
|
24
24
|
end
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.5.
|
1
|
+
0.5.1
|
data/expectr.gemspec
ADDED
@@ -0,0 +1,58 @@
|
|
1
|
+
# Generated by jeweler
|
2
|
+
# DO NOT EDIT THIS FILE DIRECTLY
|
3
|
+
# Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
|
4
|
+
# -*- encoding: utf-8 -*-
|
5
|
+
|
6
|
+
Gem::Specification.new do |s|
|
7
|
+
s.name = "expectr"
|
8
|
+
s.version = "0.5.1"
|
9
|
+
|
10
|
+
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
|
+
s.authors = ["Chris Wuest"]
|
12
|
+
s.date = "2012-02-23"
|
13
|
+
s.description = "Implementation of functionality from NIST Expect in Ruby, with an emphasis on control and extensibility"
|
14
|
+
s.email = "chris@chriswuest.com"
|
15
|
+
s.extra_rdoc_files = [
|
16
|
+
"LICENSE.txt",
|
17
|
+
"README.rdoc"
|
18
|
+
]
|
19
|
+
s.files = [
|
20
|
+
".document",
|
21
|
+
"Gemfile",
|
22
|
+
"LICENSE.txt",
|
23
|
+
"README.rdoc",
|
24
|
+
"Rakefile",
|
25
|
+
"VERSION",
|
26
|
+
"expectr.gemspec",
|
27
|
+
"lib/expectr.rb",
|
28
|
+
"test/helper.rb",
|
29
|
+
"test/test_expectr.rb"
|
30
|
+
]
|
31
|
+
s.homepage = "http://github.com/cwuest/expectr"
|
32
|
+
s.licenses = ["MIT"]
|
33
|
+
s.require_paths = ["lib"]
|
34
|
+
s.rubygems_version = "1.8.10"
|
35
|
+
s.summary = "Expect for Ruby"
|
36
|
+
|
37
|
+
if s.respond_to? :specification_version then
|
38
|
+
s.specification_version = 3
|
39
|
+
|
40
|
+
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
41
|
+
s.add_development_dependency(%q<shoulda>, [">= 0"])
|
42
|
+
s.add_development_dependency(%q<rdoc>, ["~> 3.12"])
|
43
|
+
s.add_development_dependency(%q<bundler>, ["~> 1.0.0"])
|
44
|
+
s.add_development_dependency(%q<jeweler>, ["~> 1.8.3"])
|
45
|
+
else
|
46
|
+
s.add_dependency(%q<shoulda>, [">= 0"])
|
47
|
+
s.add_dependency(%q<rdoc>, ["~> 3.12"])
|
48
|
+
s.add_dependency(%q<bundler>, ["~> 1.0.0"])
|
49
|
+
s.add_dependency(%q<jeweler>, ["~> 1.8.3"])
|
50
|
+
end
|
51
|
+
else
|
52
|
+
s.add_dependency(%q<shoulda>, [">= 0"])
|
53
|
+
s.add_dependency(%q<rdoc>, ["~> 3.12"])
|
54
|
+
s.add_dependency(%q<bundler>, ["~> 1.0.0"])
|
55
|
+
s.add_dependency(%q<jeweler>, ["~> 1.8.3"])
|
56
|
+
end
|
57
|
+
end
|
58
|
+
|
data/lib/expectr.rb
CHANGED
@@ -13,6 +13,23 @@ end
|
|
13
13
|
require 'timeout'
|
14
14
|
require 'thread'
|
15
15
|
|
16
|
+
# Fixes specifically for Ruby 1.8
|
17
|
+
if RUBY_VERSION =~ /^1.8/
|
18
|
+
# Enforcing encoding is not needed in 1.8 (probably.) So, we'll define
|
19
|
+
# String#encode! to do nothing, for interoperability.
|
20
|
+
class String #:nodoc:
|
21
|
+
def encode!(encoding)
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
# In Ruby 1.8, we want to ignore SIGCHLD. This is for two reasons:
|
26
|
+
# * SIGCHLD will be sent (and cause exceptions) for every Expectr object
|
27
|
+
# created
|
28
|
+
# * As John Carter documented in his RExpect library, calls to files which
|
29
|
+
# do not exist can cause odd and unexpected behavior.
|
30
|
+
Signal.trap('CHLD', 'IGNORE')
|
31
|
+
end
|
32
|
+
|
16
33
|
# == Description
|
17
34
|
# Expectr is an implementation of the Expect library in ruby (see
|
18
35
|
# http://expect.nist.gov).
|
data/test/test_expectr.rb
CHANGED
@@ -39,21 +39,23 @@ class TestExpectr < Test::Unit::TestCase
|
|
39
39
|
end
|
40
40
|
|
41
41
|
def test_interact
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
42
|
+
unless RUBY_VERSION =~ /1.8/
|
43
|
+
exp = Expectr.new "bc", :flush_buffer => false
|
44
|
+
[
|
45
|
+
Thread.new {
|
46
|
+
sleep 1
|
47
|
+
exp.interact
|
48
|
+
},
|
49
|
+
Thread.new {
|
50
|
+
sleep 2
|
51
|
+
assert_equal exp.flush_buffer, true
|
52
|
+
exp.flush_buffer = false
|
53
|
+
exp.send "300+21\n"
|
54
|
+
exp.send "quit\n"
|
55
|
+
}
|
56
|
+
].each {|x| x.join}
|
57
|
+
|
58
|
+
assert_not_nil exp.expect /321/
|
59
|
+
end
|
58
60
|
end
|
59
61
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: expectr
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.5.
|
4
|
+
version: 0.5.1
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -13,7 +13,7 @@ date: 2012-02-23 00:00:00.000000000 Z
|
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: shoulda
|
16
|
-
requirement: &
|
16
|
+
requirement: &17995220 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ! '>='
|
@@ -21,10 +21,10 @@ dependencies:
|
|
21
21
|
version: '0'
|
22
22
|
type: :development
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *17995220
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: rdoc
|
27
|
-
requirement: &
|
27
|
+
requirement: &17990180 !ruby/object:Gem::Requirement
|
28
28
|
none: false
|
29
29
|
requirements:
|
30
30
|
- - ~>
|
@@ -32,10 +32,10 @@ dependencies:
|
|
32
32
|
version: '3.12'
|
33
33
|
type: :development
|
34
34
|
prerelease: false
|
35
|
-
version_requirements: *
|
35
|
+
version_requirements: *17990180
|
36
36
|
- !ruby/object:Gem::Dependency
|
37
37
|
name: bundler
|
38
|
-
requirement: &
|
38
|
+
requirement: &17944880 !ruby/object:Gem::Requirement
|
39
39
|
none: false
|
40
40
|
requirements:
|
41
41
|
- - ~>
|
@@ -43,10 +43,10 @@ dependencies:
|
|
43
43
|
version: 1.0.0
|
44
44
|
type: :development
|
45
45
|
prerelease: false
|
46
|
-
version_requirements: *
|
46
|
+
version_requirements: *17944880
|
47
47
|
- !ruby/object:Gem::Dependency
|
48
48
|
name: jeweler
|
49
|
-
requirement: &
|
49
|
+
requirement: &18334240 !ruby/object:Gem::Requirement
|
50
50
|
none: false
|
51
51
|
requirements:
|
52
52
|
- - ~>
|
@@ -54,10 +54,10 @@ dependencies:
|
|
54
54
|
version: 1.8.3
|
55
55
|
type: :development
|
56
56
|
prerelease: false
|
57
|
-
version_requirements: *
|
58
|
-
description: Implementation of NIST Expect in Ruby,
|
59
|
-
|
60
|
-
email: chris
|
57
|
+
version_requirements: *18334240
|
58
|
+
description: Implementation of functionality from NIST Expect in Ruby, with an emphasis
|
59
|
+
on control and extensibility
|
60
|
+
email: chris@chriswuest.com
|
61
61
|
executables: []
|
62
62
|
extensions: []
|
63
63
|
extra_rdoc_files:
|
@@ -70,6 +70,7 @@ files:
|
|
70
70
|
- README.rdoc
|
71
71
|
- Rakefile
|
72
72
|
- VERSION
|
73
|
+
- expectr.gemspec
|
73
74
|
- lib/expectr.rb
|
74
75
|
- test/helper.rb
|
75
76
|
- test/test_expectr.rb
|
@@ -88,7 +89,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
88
89
|
version: '0'
|
89
90
|
segments:
|
90
91
|
- 0
|
91
|
-
hash:
|
92
|
+
hash: 3628151474188738487
|
92
93
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
93
94
|
none: false
|
94
95
|
requirements:
|