windows-pr 1.0.8 → 1.0.9

Sign up to get free protection for your applications and to get access to all the features.
data/test/tc_handle.rb CHANGED
@@ -17,7 +17,7 @@ class TC_Windows_Handle < Test::Unit::TestCase
17
17
  end
18
18
 
19
19
  def test_numeric_constants
20
- assert_equal(-1, HandleFoo::INVALID_HANDLE_VALUE)
20
+ assert_equal(0xFFFFFFFF, HandleFoo::INVALID_HANDLE_VALUE)
21
21
  assert_equal(0x00000001, HandleFoo::HANDLE_FLAG_INHERIT)
22
22
  assert_equal(0x00000002, HandleFoo::HANDLE_FLAG_PROTECT_FROM_CLOSE)
23
23
  end
data/test/tc_mailslot.rb CHANGED
@@ -10,8 +10,8 @@ class TC_Windows_Mailslot < Test::Unit::TestCase
10
10
  include Windows::Mailslot
11
11
 
12
12
  def test_constants
13
- assert_equal(-1, MAILSLOT_WAIT_FOREVER)
14
- assert_equal(-1, MAILSLOT_NO_MESSAGE)
13
+ assert_equal(0xFFFFFFFF, MAILSLOT_WAIT_FOREVER)
14
+ assert_equal(0xFFFFFFFF, MAILSLOT_NO_MESSAGE)
15
15
  end
16
16
 
17
17
  def test_methods
@@ -7,86 +7,87 @@ require 'windows/msvcrt/string'
7
7
  require 'test/unit'
8
8
 
9
9
  class TC_Windows_MSVCRT_String < Test::Unit::TestCase
10
- include Windows::MSVCRT::String
10
+ include Windows::MSVCRT::String
11
11
 
12
- def setup
13
- @buf = 0.chr * 260
14
- end
12
+ def setup
13
+ @buf = 0.chr * 260
14
+ @str = 'hello'
15
+ end
15
16
 
16
- def test_method_constants
17
- assert_not_nil(Strcmp)
18
- assert_not_nil(Strcpy)
19
- assert_not_nil(Strcspn)
20
- assert_not_nil(Strlen)
21
- assert_not_nil(Strncpy)
22
- assert_not_nil(Strrchr)
23
- assert_not_nil(Strrev)
24
- assert_not_nil(Strtok)
25
- end
17
+ def test_method_constants
18
+ assert_not_nil(Strcmp)
19
+ assert_not_nil(Strcpy)
20
+ assert_not_nil(Strcspn)
21
+ assert_not_nil(Strlen)
22
+ assert_not_nil(Strncpy)
23
+ assert_not_nil(Strrchr)
24
+ assert_not_nil(Strrev)
25
+ assert_not_nil(Strtok)
26
+ end
26
27
 
27
- def test_strchr
28
- assert_respond_to(self, :strchr)
29
- assert_equal('llo', strchr('hello', 'l'[0]))
30
- assert_equal(nil, strchr('hello', 'x'[0]))
31
- end
28
+ def test_strchr
29
+ assert_respond_to(self, :strchr)
30
+ assert_equal('llo', strchr('hello', 108))
31
+ assert_equal(nil, strchr('hello', 120))
32
+ end
32
33
 
33
- def test_strchr_with_zero
34
- assert_nil(strchr(0, 'l'[0]))
35
- assert_nil(strchr('hello', 0))
36
- end
34
+ def test_strchr_with_zero
35
+ assert_nil(strchr(0, 'l'[0]))
36
+ assert_nil(strchr('hello', 0))
37
+ end
37
38
 
38
- def test_strchr_expected_errors
39
- assert_raise(ArgumentError){ strchr }
40
- assert_raise(ArgumentError){ strchr('hello') }
41
- end
39
+ def test_strchr_expected_errors
40
+ assert_raise(ArgumentError){ strchr }
41
+ assert_raise(ArgumentError){ strchr('hello') }
42
+ end
42
43
 
43
- def test_strcmp
44
- assert_respond_to(self, :strcmp)
45
- assert_equal(-1, strcmp('alpha', 'beta'))
46
- assert_equal(1, strcmp('beta', 'alpha'))
47
- assert_equal(0, strcmp('alpha', 'alpha'))
48
- end
44
+ def test_strcmp
45
+ assert_respond_to(self, :strcmp)
46
+ assert_equal(-1, strcmp('alpha', 'beta'))
47
+ assert_equal(1, strcmp('beta', 'alpha'))
48
+ assert_equal(0, strcmp('alpha', 'alpha'))
49
+ end
49
50
 
50
- def test_strcmp_expected_errors
51
- assert_raise(ArgumentError){ strcmp }
52
- assert_raise(ArgumentError){ strcmp('alpha') }
53
- end
51
+ def test_strcmp_expected_errors
52
+ assert_raise(ArgumentError){ strcmp }
53
+ assert_raise(ArgumentError){ strcmp('alpha') }
54
+ end
54
55
 
55
- def test_strcpy
56
- assert_respond_to(self, :strcpy)
57
- assert_kind_of(Fixnum, strcpy(@buf, ['hello'].pack('p*').unpack('L')[0]))
58
- assert_equal('hello', @buf.strip)
59
- end
56
+ def test_strcpy
57
+ assert_respond_to(self, :strcpy)
58
+ assert_kind_of(Fixnum, strcpy(@buf, ['hello'].pack('p*').unpack('L')[0]))
59
+ assert_equal('hello', @buf.strip)
60
+ end
60
61
 
61
- def test_strcspn
62
- assert_respond_to(self, :strcspn)
63
- assert_equal(3, strcspn('abcxyz123', '&^(x'))
64
- assert_equal(9, strcspn('abcxyz123', '&^(('))
65
- end
62
+ def test_strcspn
63
+ assert_respond_to(self, :strcspn)
64
+ assert_equal(3, strcspn('abcxyz123', '&^(x'))
65
+ assert_equal(9, strcspn('abcxyz123', '&^(('))
66
+ end
66
67
 
67
- def test_strcspn_expected_errors
68
- assert_raise(ArgumentError){ strcspn }
69
- assert_raise(ArgumentError){ strcspn('alpha') }
70
- end
68
+ def test_strcspn_expected_errors
69
+ assert_raise(ArgumentError){ strcspn }
70
+ assert_raise(ArgumentError){ strcspn('alpha') }
71
+ end
71
72
 
72
- def test_strlen
73
- assert_respond_to(self, :strlen)
74
- assert_equal(5, strlen('hello'))
75
- assert_equal(0, strlen(''))
76
- end
73
+ def test_strlen
74
+ assert_respond_to(self, :strlen)
75
+ assert_equal(5, strlen('hello'))
76
+ assert_equal(0, strlen(''))
77
+ end
77
78
 
78
- def test_strlen_expected_errors
79
- assert_raise(ArgumentError){ strlen }
80
- assert_raise(ArgumentError){ strlen('a', 'b') }
81
- end
79
+ def test_strlen_expected_errors
80
+ assert_raise(ArgumentError){ strlen }
81
+ assert_raise(ArgumentError){ strlen('a', 'b') }
82
+ end
82
83
 
83
- def test_strncpy
84
- assert_respond_to(self, :strncpy)
85
- assert_equal('alp', strncpy(@buf, 'alpha', 3))
86
- assert_equal('alp', @buf.strip)
87
- end
84
+ def test_strncpy
85
+ assert_respond_to(self, :strncpy)
86
+ assert_equal('alp', strncpy(@buf, 'alpha', 3))
87
+ assert_equal('alp', @buf.strip)
88
+ end
88
89
 
89
- def teardown
90
- @buf = nil
91
- end
90
+ def teardown
91
+ @buf = nil
92
+ end
92
93
  end
@@ -17,7 +17,7 @@ class TC_Windows_Network_Management < Test::Unit::TestCase
17
17
 
18
18
  def test_numeric_constants
19
19
  assert_equal(0, NetworkManagementFoo::NERR_Success)
20
- assert_equal(-1, NetworkManagementFoo::MAX_PREFERRED_LENGTH)
20
+ assert_equal(0xFFFFFFFF, NetworkManagementFoo::MAX_PREFERRED_LENGTH)
21
21
  assert_equal(0x00000001, NetworkManagementFoo::SV_TYPE_WORKSTATION)
22
22
  end
23
23
 
data/test/tc_unicode.rb CHANGED
@@ -1,82 +1,83 @@
1
- #####################################################################
2
- # tc_unicode.rb
3
- #
4
- # Test case for the Windows::Unicode module.
5
- #####################################################################
6
- require "windows/unicode"
7
- require "test/unit"
8
-
9
- class TC_Windows_Unicode < Test::Unit::TestCase
10
- include Windows::Unicode
11
-
12
- def test_numeric_constants
13
- assert_equal(0, CP_ACP)
14
- assert_equal(1, CP_OEMCP)
15
- assert_equal(2, CP_MACCP)
16
- assert_equal(3, CP_THREAD_ACP)
17
- assert_equal(42, CP_SYMBOL)
18
- assert_equal(65000, CP_UTF7)
19
- assert_equal(65001, CP_UTF8)
20
-
21
- assert_equal(0x00000001, MB_PRECOMPOSED)
22
- assert_equal(0x00000002, MB_COMPOSITE)
23
- assert_equal(0x00000004, MB_USEGLYPHCHARS)
24
- assert_equal(0x00000008, MB_ERR_INVALID_CHARS)
25
-
26
- assert_equal(0x00000200, WC_COMPOSITECHECK)
27
- assert_equal(0x00000010, WC_DISCARDNS)
28
- assert_equal(0x00000020, WC_SEPCHARS)
29
- assert_equal(0x00000040, WC_DEFAULTCHAR)
30
- assert_equal(0x00000400, WC_NO_BEST_FIT_CHARS)
31
- end
32
-
33
- def test_method_constants
34
- assert_respond_to(self, :GetTextCharset)
35
- assert_respond_to(self, :GetTextCharsetInfo)
36
- assert_respond_to(self, :IsDBCSLeadByte)
37
- assert_respond_to(self, :IsDBCSLeadByteEx)
38
- assert_respond_to(self, :IsTextUnicode)
39
- assert_respond_to(self, :MultiByteToWideChar)
40
- assert_respond_to(self, :TranslateCharsetInfo)
41
- assert_respond_to(self, :WideCharToMultiByte)
42
- end
43
-
44
- def test_multi_to_wide
45
- assert_respond_to(self, :multi_to_wide)
46
- assert_equal("\000\000", multi_to_wide(''))
47
- assert_equal("h\000e\000l\000l\000o\000\000\000", multi_to_wide('hello'))
48
- assert_equal("\316\000\" \316\000\273\000\316\000\273\000\316\000\254\000\317\000\222\001\000\000", multi_to_wide("Ελλάσ"))
49
- end
50
-
51
- def test_multi_to_wide_with_encoding
52
- assert_equal("h\000e\000l\000l\000o\000\000\000", multi_to_wide('hello', CP_UTF8))
53
- assert_equal("\225\003\273\003\273\003\254\003\303\003\000\000", multi_to_wide("Ελλάσ", CP_UTF8))
54
- end
55
-
56
- def test_multi_to_wide_expected_errors
57
- assert_raise(TypeError){ multi_to_wide(1) }
58
- assert_raise(TypeError){ multi_to_wide([]) }
59
- end
60
-
61
- def test_wide_to_multi
62
- assert_respond_to(self, :wide_to_multi)
63
- assert_equal('', wide_to_multi("\000\000"))
64
- assert_equal('hello', wide_to_multi("h\000e\000l\000l\000o\000\000\000"))
65
- assert_equal("Ελλάσ", wide_to_multi("\316\000\" \316\000\273\000\316\000\273\000\316\000\254\000\317\000\222\001\000\000"))
66
- end
67
-
68
- def test_wide_to_multi_with_encoding
69
- assert_equal('hello', wide_to_multi("h\000e\000l\000l\000o\000\000\000"), CP_UTF8)
70
- assert_equal("Ελλάσ", wide_to_multi("\225\003\273\003\273\003\254\003\303\003\000\000", CP_UTF8))
71
- end
72
-
73
- def test_wide_to_multi_expected_errors
74
- assert_raise(TypeError){ wide_to_multi(1) }
75
- assert_raise(TypeError){ wide_to_multi([]) }
76
- end
77
-
78
- def teardown
79
- @foo = nil
80
- @unicode = nil
81
- end
82
- end
1
+ # encoding: ascii-8bit
2
+ #####################################################################
3
+ # tc_unicode.rb
4
+ #
5
+ # Test case for the Windows::Unicode module.
6
+ #####################################################################
7
+ require "windows/unicode"
8
+ require "test/unit"
9
+
10
+ class TC_Windows_Unicode < Test::Unit::TestCase
11
+ include Windows::Unicode
12
+
13
+ def test_numeric_constants
14
+ assert_equal(0, CP_ACP)
15
+ assert_equal(1, CP_OEMCP)
16
+ assert_equal(2, CP_MACCP)
17
+ assert_equal(3, CP_THREAD_ACP)
18
+ assert_equal(42, CP_SYMBOL)
19
+ assert_equal(65000, CP_UTF7)
20
+ assert_equal(65001, CP_UTF8)
21
+
22
+ assert_equal(0x00000001, MB_PRECOMPOSED)
23
+ assert_equal(0x00000002, MB_COMPOSITE)
24
+ assert_equal(0x00000004, MB_USEGLYPHCHARS)
25
+ assert_equal(0x00000008, MB_ERR_INVALID_CHARS)
26
+
27
+ assert_equal(0x00000200, WC_COMPOSITECHECK)
28
+ assert_equal(0x00000010, WC_DISCARDNS)
29
+ assert_equal(0x00000020, WC_SEPCHARS)
30
+ assert_equal(0x00000040, WC_DEFAULTCHAR)
31
+ assert_equal(0x00000400, WC_NO_BEST_FIT_CHARS)
32
+ end
33
+
34
+ def test_method_constants
35
+ assert_respond_to(self, :GetTextCharset)
36
+ assert_respond_to(self, :GetTextCharsetInfo)
37
+ assert_respond_to(self, :IsDBCSLeadByte)
38
+ assert_respond_to(self, :IsDBCSLeadByteEx)
39
+ assert_respond_to(self, :IsTextUnicode)
40
+ assert_respond_to(self, :MultiByteToWideChar)
41
+ assert_respond_to(self, :TranslateCharsetInfo)
42
+ assert_respond_to(self, :WideCharToMultiByte)
43
+ end
44
+
45
+ def test_multi_to_wide
46
+ assert_respond_to(self, :multi_to_wide)
47
+ assert_equal("\000\000", multi_to_wide(''))
48
+ assert_equal("h\000e\000l\000l\000o\000\000\000", multi_to_wide('hello'))
49
+ assert_equal("\316\000\" \316\000\273\000\316\000\273\000\316\000\254\000\317\000\222\001\000\000", multi_to_wide("Ελλάσ"))
50
+ end
51
+
52
+ def test_multi_to_wide_with_encoding
53
+ assert_equal("h\000e\000l\000l\000o\000\000\000", multi_to_wide('hello', CP_UTF8))
54
+ assert_equal("\225\003\273\003\273\003\254\003\303\003\000\000", multi_to_wide("Ελλάσ", CP_UTF8))
55
+ end
56
+
57
+ def test_multi_to_wide_expected_errors
58
+ assert_raise(TypeError){ multi_to_wide(1) }
59
+ assert_raise(TypeError){ multi_to_wide([]) }
60
+ end
61
+
62
+ def test_wide_to_multi
63
+ assert_respond_to(self, :wide_to_multi)
64
+ assert_equal('', wide_to_multi("\000\000"))
65
+ assert_equal('hello', wide_to_multi("h\000e\000l\000l\000o\000\000\000"))
66
+ assert_equal("Ελλάσ", wide_to_multi("\316\000\" \316\000\273\000\316\000\273\000\316\000\254\000\317\000\222\001\000\000"))
67
+ end
68
+
69
+ def test_wide_to_multi_with_encoding
70
+ assert_equal('hello', wide_to_multi("h\000e\000l\000l\000o\000\000\000"), CP_UTF8)
71
+ assert_equal("Ελλάσ", wide_to_multi("\225\003\273\003\273\003\254\003\303\003\000\000", CP_UTF8))
72
+ end
73
+
74
+ def test_wide_to_multi_expected_errors
75
+ assert_raise(TypeError){ wide_to_multi(1) }
76
+ assert_raise(TypeError){ wide_to_multi([]) }
77
+ end
78
+
79
+ def teardown
80
+ @foo = nil
81
+ @unicode = nil
82
+ end
83
+ end
data/windows-pr.gemspec CHANGED
@@ -1,36 +1,34 @@
1
1
  require 'rubygems'
2
2
 
3
- spec = Gem::Specification.new do |gem|
4
- gem.name = 'windows-pr'
5
- gem.version = '1.0.8'
6
- gem.license = 'Artistic 2.0'
7
- gem.authors = ['Daniel J. Berger', 'Park Heesob']
8
- gem.email = 'djberg96@gmail.com'
9
- gem.homepage = 'http://www.rubyforge.org/projects/win32utils'
10
- gem.platform = Gem::Platform::RUBY
11
- gem.summary = 'Windows functions and constants bundled via Win32::API'
12
- gem.test_files = Dir["test/tc*"]
13
- gem.files = Dir["**/*"].reject{ |f| f.include?('CVS') }
3
+ Gem::Specification.new do |spec|
4
+ spec.name = 'windows-pr'
5
+ spec.version = '1.0.9'
6
+ spec.license = 'Artistic 2.0'
7
+ spec.authors = ['Daniel J. Berger', 'Park Heesob']
8
+ spec.email = 'djberg96@gmail.com'
9
+ spec.homepage = 'http://www.rubyforge.org/projects/win32utils'
10
+ spec.platform = Gem::Platform::RUBY
11
+ spec.summary = 'Windows functions and constants bundled via Win32::API'
12
+ spec.test_files = Dir["test/tc*"]
13
+ spec.files = Dir["**/*"].reject{ |f| f.include?('git') }
14
14
 
15
- gem.rubyforge_project = 'win32utils'
15
+ spec.rubyforge_project = 'win32utils'
16
16
 
17
- gem.extra_rdoc_files = [
18
- 'MANIFEST',
19
- 'README',
20
- 'CHANGES',
21
- 'doc/conversion_guide.txt'
22
- ]
17
+ spec.extra_rdoc_files = [
18
+ 'MANIFEST',
19
+ 'README',
20
+ 'CHANGES',
21
+ 'doc/conversion_guide.txt'
22
+ ]
23
23
 
24
- gem.add_dependency('windows-api', '>= 0.3.0')
25
- gem.add_dependency('win32-api', '>= 1.4.5')
24
+ spec.add_dependency('windows-api', '>= 0.3.0')
25
+ spec.add_dependency('win32-api', '>= 1.4.5')
26
26
 
27
- gem.description = <<-EOF
28
- The windows-pr library is a collection of Windows functions and constants
29
- pre-defined for you using the windows-api library. It also autogenerates
30
- explicit ANSI and Wide character versions of those functions, as well as
31
- constants that can be used as methods, e.g. CloseHandle() instead of
32
- CloseHandle.call().
33
- EOF
27
+ spec.description = <<-EOF
28
+ The windows-pr library is a collection of Windows functions and constants
29
+ pre-defined for you using the windows-api library. It also autogenerates
30
+ explicit ANSI and Wide character versions of those functions, as well as
31
+ constants that can be used as methods, e.g. CloseHandle() instead of
32
+ CloseHandle.call().
33
+ EOF
34
34
  end
35
-
36
- Gem::Builder.new(spec).build
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: windows-pr
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.8
4
+ version: 1.0.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - Daniel J. Berger
@@ -10,7 +10,7 @@ autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
12
 
13
- date: 2009-08-24 00:00:00 -06:00
13
+ date: 2010-02-06 00:00:00 -07:00
14
14
  default_executable:
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
@@ -33,7 +33,7 @@ dependencies:
33
33
  - !ruby/object:Gem::Version
34
34
  version: 1.4.5
35
35
  version:
36
- description: " The windows-pr library is a collection of Windows functions and constants\n pre-defined for you using the windows-api library. It also autogenerates\n explicit ANSI and Wide character versions of those functions, as well as\n constants that can be used as methods, e.g. CloseHandle() instead of\n CloseHandle.call().\n"
36
+ description: " The windows-pr library is a collection of Windows functions and constants\n pre-defined for you using the windows-api library. It also autogenerates\n explicit ANSI and Wide character versions of those functions, as well as\n constants that can be used as methods, e.g. CloseHandle() instead of\n CloseHandle.call().\n"
37
37
  email: djberg96@gmail.com
38
38
  executables: []
39
39