win32-nio 0.2.1 → 0.2.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,79 +1,79 @@
1
- ########################################################################
2
- # test_win32_nio_read.rb
3
- #
4
- # Tests for the NIO.read method.
5
- ########################################################################
6
- require 'test-unit'
7
- require 'win32/nio'
8
- include Win32
9
-
10
- class TC_Win32_NIO_Read < Test::Unit::TestCase
11
- def self.startup
12
- Dir.chdir(File.expand_path(File.dirname(__FILE__)))
13
-
14
- @@file = 'read_test.txt'
15
- @@text = "The quick brown fox jumped over the lazy dog's back"
16
-
17
- File.open(@@file, 'w'){ |fh|
18
- 100.times{ |n| fh.puts @@text + ": #{n}" }
19
- }
20
- end
21
-
22
- def setup
23
- @size = File.size(@@file)
24
- end
25
-
26
- test "version number is set to expected value" do
27
- assert_equal('0.2.1', Win32::NIO::VERSION)
28
- end
29
-
30
- test "read method basic functionality" do
31
- assert_respond_to(NIO, :read)
32
- assert_nothing_raised{ NIO.read(@@file) }
33
- end
34
-
35
- test "read method accepts a file name and returns a string of the expected size" do
36
- assert_kind_of(String, NIO.read(@@file))
37
- assert_true(NIO.read(@@file).size == @size)
38
- end
39
-
40
- test "read method accepts a length argument and returns a string of that length" do
41
- assert_nothing_raised{ NIO.read(@@file, 19) }
42
- assert_equal('The quick brown fox', NIO.read(@@file, 19))
43
- assert_equal('', NIO.read(@@file, 0))
44
- end
45
-
46
- test "read method accepts an offset and returns a string between offset and length" do
47
- assert_nothing_raised{ NIO.read(@@file, 19, 4) }
48
- assert_equal('quick brown fox', NIO.read(@@file, 15, 4))
49
- assert_equal("lazy dog's back: 99\r\n", NIO.read(@@file, nil, @size-21))
50
- end
51
-
52
- test "read method requires at least one argument" do
53
- assert_raise(ArgumentError){ NIO.read }
54
- end
55
-
56
- test "length parameter must be a positive number" do
57
- assert_raise(ArgumentError){ NIO.read(@@file, -1) }
58
- assert_raise(TypeError){ NIO.read(@@file, 'foo') }
59
- end
60
-
61
- test "offset parameter must be a positive number" do
62
- assert_raise(ArgumentError){ NIO.read(@@file, 1, -1) }
63
- assert_raise(TypeError){ NIO.read(@@file, 1, 'foo') }
64
- end
65
-
66
- test "options parameter must be a hash" do
67
- assert_raise(TypeError){ NIO.read(@@file, 1, 1, 'foo') }
68
- end
69
-
70
- def teardown
71
- @size = nil
72
- end
73
-
74
- def self.shutdown
75
- File.delete(@@file) if File.exist?(@@file)
76
- @@file = nil
77
- @@text = nil
78
- end
79
- end
1
+ ########################################################################
2
+ # test_win32_nio_read.rb
3
+ #
4
+ # Tests for the NIO.read method.
5
+ ########################################################################
6
+ require 'test-unit'
7
+ require 'win32/nio'
8
+ include Win32
9
+
10
+ class TC_Win32_NIO_Read < Test::Unit::TestCase
11
+ def self.startup
12
+ Dir.chdir(File.expand_path(File.dirname(__FILE__)))
13
+
14
+ @@file = 'read_test.txt'
15
+ @@text = "The quick brown fox jumped over the lazy dog's back"
16
+
17
+ File.open(@@file, 'w'){ |fh|
18
+ 100.times{ |n| fh.puts @@text + ": #{n}" }
19
+ }
20
+ end
21
+
22
+ def setup
23
+ @size = File.size(@@file)
24
+ end
25
+
26
+ test "version number is set to expected value" do
27
+ assert_equal('0.2.2', Win32::NIO::VERSION)
28
+ end
29
+
30
+ test "read method basic functionality" do
31
+ assert_respond_to(NIO, :read)
32
+ assert_nothing_raised{ NIO.read(@@file) }
33
+ end
34
+
35
+ test "read method accepts a file name and returns a string of the expected size" do
36
+ assert_kind_of(String, NIO.read(@@file))
37
+ assert_true(NIO.read(@@file).size == @size)
38
+ end
39
+
40
+ test "read method accepts a length argument and returns a string of that length" do
41
+ assert_nothing_raised{ NIO.read(@@file, 19) }
42
+ assert_equal('The quick brown fox', NIO.read(@@file, 19))
43
+ assert_equal('', NIO.read(@@file, 0))
44
+ end
45
+
46
+ test "read method accepts an offset and returns a string between offset and length" do
47
+ assert_nothing_raised{ NIO.read(@@file, 19, 4) }
48
+ assert_equal('quick brown fox', NIO.read(@@file, 15, 4))
49
+ assert_equal("lazy dog's back: 99\r\n", NIO.read(@@file, nil, @size-21))
50
+ end
51
+
52
+ test "read method requires at least one argument" do
53
+ assert_raise(ArgumentError){ NIO.read }
54
+ end
55
+
56
+ test "length parameter must be a positive number" do
57
+ assert_raise(ArgumentError){ NIO.read(@@file, -1) }
58
+ assert_raise(TypeError){ NIO.read(@@file, 'foo') }
59
+ end
60
+
61
+ test "offset parameter must be a positive number" do
62
+ assert_raise(ArgumentError){ NIO.read(@@file, 1, -1) }
63
+ assert_raise(TypeError){ NIO.read(@@file, 1, 'foo') }
64
+ end
65
+
66
+ test "options parameter must be a hash" do
67
+ assert_raise(TypeError){ NIO.read(@@file, 1, 1, 'foo') }
68
+ end
69
+
70
+ def teardown
71
+ @size = nil
72
+ end
73
+
74
+ def self.shutdown
75
+ File.delete(@@file) if File.exist?(@@file)
76
+ @@file = nil
77
+ @@text = nil
78
+ end
79
+ end
@@ -1,75 +1,75 @@
1
- #######################################################################
2
- # test_win32_nio_readlines.rb
3
- #
4
- # Test case for the Win32::NIO.readlines method.
5
- #######################################################################
6
- require 'test-unit'
7
- require 'win32/nio'
8
- require 'win32/event'
9
- include Win32
10
-
11
- class TC_Win32_NIO_Readlines < Test::Unit::TestCase
12
- def self.startup
13
- @@line = "The quick brown fox jumped over the lazy dog's back"
14
- @@file = "readlines_test.txt"
15
- @@size = 10
16
-
17
- File.open(@@file, 'w'){ |fh|
18
- 1.upto(@@size){ |n|
19
- fh.puts @@line + ": #{n}"
20
- fh.puts if n % 3 == 0
21
- }
22
- }
23
- end
24
-
25
- def setup
26
- @array = nil
27
- @event = Win32::Event.new
28
- end
29
-
30
- test "readlines method basic functionality" do
31
- assert_respond_to(NIO, :readlines)
32
- assert_nothing_raised{ NIO.readlines(@@file) }
33
- end
34
-
35
- test "readlines returns an array" do
36
- assert_kind_of(Array, NIO.readlines(@@file))
37
- end
38
-
39
- test "readlines returns an array of the expected size" do
40
- assert_equal(@@size + 3, NIO.readlines(@@file).size)
41
- assert_equal(@@line + ': 1', NIO.readlines(@@file).first)
42
- end
43
-
44
- test "readlines treats an empty second argument as a paragraph separator" do
45
- assert_nothing_raised{ NIO.readlines(@@file, '') }
46
- assert_kind_of(Array, NIO.readlines(@@file, ''))
47
- assert_equal(4, NIO.readlines(@@file, '').size)
48
- end
49
-
50
- test "readlines accepts an event object" do
51
- assert_false(@event.signaled?)
52
- assert_nothing_raised{ NIO.readlines(@@file, nil, @event) }
53
- assert_true(@event.signaled?)
54
- end
55
-
56
- test "readlines expects at least one argument" do
57
- assert_raise(ArgumentError){ NIO.readlines }
58
- end
59
-
60
- test "readlines accepts a maximum of three arguments" do
61
- assert_raise(ArgumentError){ NIO.readlines(@@file, '', @event, true) }
62
- end
63
-
64
- def teardown
65
- @array = nil
66
- @event = nil
67
- end
68
-
69
- def self.shutdown
70
- File.delete(@@file) if File.exist?(@@file)
71
- @@file = nil
72
- @@size = nil
73
- @@line = nil
74
- end
75
- end
1
+ #######################################################################
2
+ # test_win32_nio_readlines.rb
3
+ #
4
+ # Test case for the Win32::NIO.readlines method.
5
+ #######################################################################
6
+ require 'test-unit'
7
+ require 'win32/nio'
8
+ require 'win32/event'
9
+ include Win32
10
+
11
+ class TC_Win32_NIO_Readlines < Test::Unit::TestCase
12
+ def self.startup
13
+ @@line = "The quick brown fox jumped over the lazy dog's back"
14
+ @@file = "readlines_test.txt"
15
+ @@size = 10
16
+
17
+ File.open(@@file, 'w'){ |fh|
18
+ 1.upto(@@size){ |n|
19
+ fh.puts @@line + ": #{n}"
20
+ fh.puts if n % 3 == 0
21
+ }
22
+ }
23
+ end
24
+
25
+ def setup
26
+ @array = nil
27
+ @event = Win32::Event.new
28
+ end
29
+
30
+ test "readlines method basic functionality" do
31
+ assert_respond_to(NIO, :readlines)
32
+ assert_nothing_raised{ NIO.readlines(@@file) }
33
+ end
34
+
35
+ test "readlines returns an array" do
36
+ assert_kind_of(Array, NIO.readlines(@@file))
37
+ end
38
+
39
+ test "readlines returns an array of the expected size" do
40
+ assert_equal(@@size + 3, NIO.readlines(@@file).size)
41
+ assert_equal(@@line + ': 1', NIO.readlines(@@file).first)
42
+ end
43
+
44
+ test "readlines treats an empty second argument as a paragraph separator" do
45
+ assert_nothing_raised{ NIO.readlines(@@file, '') }
46
+ assert_kind_of(Array, NIO.readlines(@@file, ''))
47
+ assert_equal(4, NIO.readlines(@@file, '').size)
48
+ end
49
+
50
+ test "readlines accepts an event object" do
51
+ assert_false(@event.signaled?)
52
+ assert_nothing_raised{ NIO.readlines(@@file, nil, @event) }
53
+ assert_true(@event.signaled?)
54
+ end
55
+
56
+ test "readlines expects at least one argument" do
57
+ assert_raise(ArgumentError){ NIO.readlines }
58
+ end
59
+
60
+ test "readlines accepts a maximum of three arguments" do
61
+ assert_raise(ArgumentError){ NIO.readlines(@@file, '', @event, true) }
62
+ end
63
+
64
+ def teardown
65
+ @array = nil
66
+ @event = nil
67
+ end
68
+
69
+ def self.shutdown
70
+ File.delete(@@file) if File.exist?(@@file)
71
+ @@file = nil
72
+ @@size = nil
73
+ @@line = nil
74
+ end
75
+ end
@@ -1,28 +1,29 @@
1
- require 'rubygems'
2
-
3
- Gem::Specification.new do |spec|
4
- spec.name = 'win32-nio'
5
- spec.version = '0.2.1'
6
- spec.author = 'Daniel J. Berger'
7
- spec.license = 'Artistic 2.0'
8
- spec.email = 'djberg96@gmail.com'
9
- spec.homepage = 'https://github.com/djberg96/win32-nio'
10
- spec.summary = 'Native IO for MS Windows'
11
- spec.files = Dir['**/*'].reject{ |f| f.include?('git') }
12
- spec.extensions = ['ext/extconf.rb']
13
-
14
- spec.extra_rdoc_files = ['README', 'CHANGES', 'MANIFEST']
15
- spec.required_ruby_version = '>= 1.9.3'
16
-
17
- spec.add_dependency('win32-event', '>= 0.6.0')
18
-
19
- spec.add_development_dependency('rake')
20
- spec.add_development_dependency('test-unit')
21
-
22
- spec.description = <<-EOF
23
- The win32-nio library implements certain IO methods using native
24
- Windows function calls rather than using the POSIX compatibility
25
- layer that MRI typically uses. In addition, some methods provide
26
- additional event handling capability.
27
- EOF
28
- end
1
+ require 'rubygems'
2
+
3
+ Gem::Specification.new do |spec|
4
+ spec.name = 'win32-nio'
5
+ spec.version = '0.2.2'
6
+ spec.author = 'Daniel J. Berger'
7
+ spec.license = 'Artistic 2.0'
8
+ spec.email = 'djberg96@gmail.com'
9
+ spec.homepage = 'https://github.com/djberg96/win32-nio'
10
+ spec.summary = 'Native IO for MS Windows'
11
+ spec.extensions = ['ext/extconf.rb']
12
+ spec.files = Dir['**/*'].reject{ |f| f.include?('git') }
13
+ spec.cert_chain = Dir['certs/*']
14
+
15
+ spec.extra_rdoc_files = ['README', 'CHANGES', 'MANIFEST']
16
+ spec.required_ruby_version = '>= 1.9.3'
17
+
18
+ spec.add_dependency('win32-event', '>= 0.6.0')
19
+
20
+ spec.add_development_dependency('rake')
21
+ spec.add_development_dependency('test-unit')
22
+
23
+ spec.description = <<-EOF
24
+ The win32-nio library implements certain IO methods using native
25
+ Windows function calls rather than using the POSIX compatibility
26
+ layer that MRI typically uses. In addition, some methods provide
27
+ additional event handling capability.
28
+ EOF
29
+ end
metadata CHANGED
@@ -1,14 +1,36 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: win32-nio
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.1
4
+ version: 0.2.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Daniel J. Berger
8
8
  autorequire:
9
9
  bindir: bin
10
- cert_chain: []
11
- date: 2015-06-21 00:00:00.000000000 Z
10
+ cert_chain:
11
+ - |
12
+ -----BEGIN CERTIFICATE-----
13
+ MIIDcDCCAligAwIBAgIBATANBgkqhkiG9w0BAQUFADA/MREwDwYDVQQDDAhkamJl
14
+ cmc5NjEVMBMGCgmSJomT8ixkARkWBWdtYWlsMRMwEQYKCZImiZPyLGQBGRYDY29t
15
+ MB4XDTE1MDkwMjIwNDkxOFoXDTE2MDkwMTIwNDkxOFowPzERMA8GA1UEAwwIZGpi
16
+ ZX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+ -----END CERTIFICATE-----
33
+ date: 2015-11-18 00:00:00.000000000 Z
12
34
  dependencies:
13
35
  - !ruby/object:Gem::Dependency
14
36
  name: win32-event
@@ -66,13 +88,20 @@ extra_rdoc_files:
66
88
  - CHANGES
67
89
  - MANIFEST
68
90
  files:
69
- - CHANGES
70
- - MANIFEST
71
- - README
72
- - Rakefile
91
+ - appveyor.yml
92
+ - benchmarks
73
93
  - benchmarks/win32_nio_benchmarks.rb
94
+ - certs
95
+ - certs/djberg96_pub.pem
96
+ - CHANGES
97
+ - ext
74
98
  - ext/extconf.rb
99
+ - ext/win32
75
100
  - ext/win32/nio.c
101
+ - MANIFEST
102
+ - Rakefile
103
+ - README
104
+ - test
76
105
  - test/test_win32_nio_read.rb
77
106
  - test/test_win32_nio_readlines.rb
78
107
  - win32-nio.gemspec
@@ -96,7 +125,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
96
125
  version: '0'
97
126
  requirements: []
98
127
  rubyforge_project:
99
- rubygems_version: 2.4.5
128
+ rubygems_version: 2.4.8
100
129
  signing_key:
101
130
  specification_version: 4
102
131
  summary: Native IO for MS Windows
@@ -0,0 +1,3 @@
1
+ �:R7�,kG��d�Nc�
2
+ 7�`#D���F��nj��r!�xZ���h������b��gBt�����1���!n^g����߮l�'h�-�ڲ ��#w4�r"�J�b�y8���7��,� `�U�`��Z=�%|��#�;��{�_[�=��+f��lo��v�>���י+�{h�TY�桢�ܛ���ӭn�d!�n���?�
3
+ �:r�Z## �"Xmh4;�TL���E�k����,�=iW{Ww���/��