windows-pr 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGES +2 -0
- data/MANIFEST +20 -0
- data/README +117 -0
- data/doc/conversion_guide.txt +25 -0
- data/lib/windows/clipboard.rb +105 -0
- data/lib/windows/device_io.rb +141 -0
- data/lib/windows/error.rb +92 -0
- data/lib/windows/file.rb +290 -0
- data/lib/windows/handle.rb +47 -0
- data/lib/windows/memory.rb +92 -0
- data/lib/windows/msvcrt/buffer.rb +48 -0
- data/lib/windows/msvcrt/file.rb +18 -0
- data/lib/windows/path.rb +372 -0
- data/lib/windows/sound.rb +52 -0
- data/lib/windows/synchronize.rb +61 -0
- data/test/tc_error.rb +57 -0
- data/test/tc_msvcrt_buffer.rb +71 -0
- data/test/tc_path.rb +97 -0
- data/test/tc_synchronize.rb +43 -0
- data/test/ts_all.rb +10 -0
- metadata +67 -0
data/test/tc_error.rb
ADDED
@@ -0,0 +1,57 @@
|
|
1
|
+
#####################################################################
|
2
|
+
# tc_error.rb
|
3
|
+
#
|
4
|
+
# Test case for the Windows::Error module.
|
5
|
+
#####################################################################
|
6
|
+
base = File.basename(Dir.pwd)
|
7
|
+
if base == 'test' || base =~ /windows-pr/
|
8
|
+
Dir.chdir '..' if base == 'test'
|
9
|
+
$LOAD_PATH.unshift Dir.pwd + '/lib'
|
10
|
+
Dir.chdir 'test' rescue nil
|
11
|
+
end
|
12
|
+
|
13
|
+
require "windows/error"
|
14
|
+
require "test/unit"
|
15
|
+
|
16
|
+
class Foo
|
17
|
+
include Windows::Error
|
18
|
+
end
|
19
|
+
|
20
|
+
class TC_Windows_Error < Test::Unit::TestCase
|
21
|
+
|
22
|
+
def setup
|
23
|
+
@foo = Foo.new
|
24
|
+
end
|
25
|
+
|
26
|
+
def test_numeric_constants
|
27
|
+
assert_equal(0x00000100, Foo::FORMAT_MESSAGE_ALLOCATE_BUFFER)
|
28
|
+
assert_equal(0x00000200, Foo::FORMAT_MESSAGE_IGNORE_INSERTS)
|
29
|
+
assert_equal(0x00000400, Foo::FORMAT_MESSAGE_FROM_STRING)
|
30
|
+
assert_equal(0x00000800, Foo::FORMAT_MESSAGE_FROM_HMODULE)
|
31
|
+
assert_equal(0x00001000, Foo::FORMAT_MESSAGE_FROM_SYSTEM)
|
32
|
+
assert_equal(0x00002000, Foo::FORMAT_MESSAGE_ARGUMENT_ARRAY)
|
33
|
+
assert_equal(0x000000FF, Foo::FORMAT_MESSAGE_MAX_WIDTH_MASK)
|
34
|
+
assert_equal(0x0001, Foo::SEM_FAILCRITICALERRORS)
|
35
|
+
assert_equal(0x0004, Foo::SEM_NOALIGNMENTFAULTEXCEPT)
|
36
|
+
assert_equal(0x0002, Foo::SEM_NOGPFAULTERRORBOX)
|
37
|
+
assert_equal(0x8000, Foo::SEM_NOOPENFILEERRORBOX)
|
38
|
+
end
|
39
|
+
|
40
|
+
def test_method_constants
|
41
|
+
assert_not_nil(Foo::GetLastError)
|
42
|
+
assert_not_nil(Foo::SetLastError)
|
43
|
+
assert_not_nil(Foo::SetLastErrorEx)
|
44
|
+
assert_not_nil(Foo::SetErrorMode)
|
45
|
+
assert_not_nil(Foo::FormatMessage)
|
46
|
+
end
|
47
|
+
|
48
|
+
def test_get_last_error
|
49
|
+
assert_respond_to(@foo, :get_last_error)
|
50
|
+
assert_nothing_raised{ @foo.get_last_error }
|
51
|
+
assert_kind_of(String, @foo.get_last_error)
|
52
|
+
end
|
53
|
+
|
54
|
+
def teardown
|
55
|
+
@foo = nil
|
56
|
+
end
|
57
|
+
end
|
@@ -0,0 +1,71 @@
|
|
1
|
+
#####################################################################
|
2
|
+
# tc_msvcrt_buffer.rb
|
3
|
+
#
|
4
|
+
# Test case for the Windows::MSVCRT::Buffer module.
|
5
|
+
#####################################################################
|
6
|
+
base = File.basename(Dir.pwd)
|
7
|
+
if base == 'test' || base =~ /windows-pr/
|
8
|
+
Dir.chdir '..' if base == 'test'
|
9
|
+
$LOAD_PATH.unshift Dir.pwd + '/lib'
|
10
|
+
Dir.chdir 'test' rescue nil
|
11
|
+
end
|
12
|
+
|
13
|
+
require "windows/msvcrt/buffer"
|
14
|
+
require "test/unit"
|
15
|
+
|
16
|
+
class Foo
|
17
|
+
include Windows::MSVCRT::Buffer
|
18
|
+
end
|
19
|
+
|
20
|
+
class TC_Windows_MSVCRT_Buffer < Test::Unit::TestCase
|
21
|
+
def setup
|
22
|
+
@foo = Foo.new
|
23
|
+
end
|
24
|
+
|
25
|
+
def test_method_constants
|
26
|
+
assert_not_nil(Foo::Memcpy)
|
27
|
+
assert_not_nil(Foo::Memccpy)
|
28
|
+
assert_not_nil(Foo::Memchr)
|
29
|
+
assert_not_nil(Foo::Memcmp)
|
30
|
+
assert_not_nil(Foo::Memicmp)
|
31
|
+
assert_not_nil(Foo::Memmove)
|
32
|
+
assert_not_nil(Foo::Memset)
|
33
|
+
assert_not_nil(Foo::Swab)
|
34
|
+
end
|
35
|
+
|
36
|
+
def test_memcpy
|
37
|
+
assert_respond_to(@foo, :memcpy)
|
38
|
+
end
|
39
|
+
|
40
|
+
def test_memccpy
|
41
|
+
assert_respond_to(@foo, :memccpy)
|
42
|
+
end
|
43
|
+
|
44
|
+
def test_memchr
|
45
|
+
assert_respond_to(@foo, :memchr)
|
46
|
+
end
|
47
|
+
|
48
|
+
def test_memcmp
|
49
|
+
assert_respond_to(@foo, :memcmp)
|
50
|
+
end
|
51
|
+
|
52
|
+
def test_memicmp
|
53
|
+
assert_respond_to(@foo, :memicmp)
|
54
|
+
end
|
55
|
+
|
56
|
+
def test_memmove
|
57
|
+
assert_respond_to(@foo, :memmove)
|
58
|
+
end
|
59
|
+
|
60
|
+
def test_memset
|
61
|
+
assert_respond_to(@foo, :memset)
|
62
|
+
end
|
63
|
+
|
64
|
+
def test_swab
|
65
|
+
assert_respond_to(@foo, :swab)
|
66
|
+
end
|
67
|
+
|
68
|
+
def teardown
|
69
|
+
@foo = nil
|
70
|
+
end
|
71
|
+
end
|
data/test/tc_path.rb
ADDED
@@ -0,0 +1,97 @@
|
|
1
|
+
#####################################################################
|
2
|
+
# tc_path.rb
|
3
|
+
#
|
4
|
+
# Test case for the Windows::Path module.
|
5
|
+
#####################################################################
|
6
|
+
base = File.basename(Dir.pwd)
|
7
|
+
if base == 'test' || base =~ /windows-pr/
|
8
|
+
Dir.chdir '..' if base == 'test'
|
9
|
+
$LOAD_PATH.unshift Dir.pwd + '/lib'
|
10
|
+
Dir.chdir 'test' rescue nil
|
11
|
+
end
|
12
|
+
|
13
|
+
require "windows/path"
|
14
|
+
require "test/unit"
|
15
|
+
|
16
|
+
class Foo
|
17
|
+
include Windows::Path
|
18
|
+
end
|
19
|
+
|
20
|
+
class TC_Windows_Path < Test::Unit::TestCase
|
21
|
+
def setup
|
22
|
+
@foo = Foo.new
|
23
|
+
@path = "C:\\"
|
24
|
+
end
|
25
|
+
|
26
|
+
def test_numeric_constants
|
27
|
+
assert_equal(0x0000, Foo::GCT_INVALID)
|
28
|
+
assert_equal(0x0001, Foo::GCT_LFNCHAR)
|
29
|
+
assert_equal(0x0002, Foo::GCT_SHORTCHAR)
|
30
|
+
assert_equal(0x0004, Foo::GCT_WILD)
|
31
|
+
assert_equal(0x0008, Foo::GCT_SEPARATOR)
|
32
|
+
end
|
33
|
+
|
34
|
+
def test_method_constants
|
35
|
+
assert_not_nil(Foo::PathAddBackslash)
|
36
|
+
assert_not_nil(Foo::PathAddExtension)
|
37
|
+
assert_not_nil(Foo::PathAppend)
|
38
|
+
assert_not_nil(Foo::PathBuildRoot)
|
39
|
+
assert_not_nil(Foo::PathCanonicalize)
|
40
|
+
assert_not_nil(Foo::PathCombine)
|
41
|
+
assert_not_nil(Foo::PathCommonPrefix)
|
42
|
+
assert_not_nil(Foo::PathCompactPath)
|
43
|
+
assert_not_nil(Foo::PathCompactPathEx)
|
44
|
+
assert_not_nil(Foo::PathCreateFromUrl)
|
45
|
+
assert_not_nil(Foo::PathFileExists)
|
46
|
+
assert_not_nil(Foo::PathFindExtension)
|
47
|
+
assert_not_nil(Foo::PathFindFileName)
|
48
|
+
assert_not_nil(Foo::PathFindNextComponent)
|
49
|
+
assert_not_nil(Foo::PathFindOnPath)
|
50
|
+
assert_not_nil(Foo::PathFindSuffixArray)
|
51
|
+
assert_not_nil(Foo::PathGetArgs)
|
52
|
+
assert_not_nil(Foo::PathGetCharType)
|
53
|
+
assert_not_nil(Foo::PathGetDriveNumber)
|
54
|
+
assert_not_nil(Foo::PathIsContentType)
|
55
|
+
assert_not_nil(Foo::PathIsDirectory)
|
56
|
+
assert_not_nil(Foo::PathIsDirectoryEmpty)
|
57
|
+
assert_not_nil(Foo::PathIsFileSpec)
|
58
|
+
#assert_not_nil(Foo::PathIsHTMLFile)
|
59
|
+
assert_not_nil(Foo::PathIsLFNFileSpec)
|
60
|
+
assert_not_nil(Foo::PathIsNetworkPath)
|
61
|
+
assert_not_nil(Foo::PathIsPrefix)
|
62
|
+
assert_not_nil(Foo::PathIsRelative)
|
63
|
+
assert_not_nil(Foo::PathIsRoot)
|
64
|
+
assert_not_nil(Foo::PathIsSameRoot)
|
65
|
+
assert_not_nil(Foo::PathIsSystemFolder)
|
66
|
+
assert_not_nil(Foo::PathIsUNC)
|
67
|
+
assert_not_nil(Foo::PathIsUNCServer)
|
68
|
+
assert_not_nil(Foo::PathIsUNCServerShare)
|
69
|
+
assert_not_nil(Foo::PathIsURL)
|
70
|
+
assert_not_nil(Foo::PathMakePretty)
|
71
|
+
assert_not_nil(Foo::PathMakeSystemFolder)
|
72
|
+
assert_not_nil(Foo::PathMatchSpec)
|
73
|
+
assert_not_nil(Foo::PathParseIconLocation)
|
74
|
+
assert_not_nil(Foo::PathQuoteSpaces)
|
75
|
+
assert_not_nil(Foo::PathRelativePathTo)
|
76
|
+
assert_not_nil(Foo::PathRemoveArgs)
|
77
|
+
assert_not_nil(Foo::PathRemoveBackslash)
|
78
|
+
assert_not_nil(Foo::PathRemoveBlanks)
|
79
|
+
assert_not_nil(Foo::PathRemoveExtension)
|
80
|
+
assert_not_nil(Foo::PathRemoveFileSpec)
|
81
|
+
assert_not_nil(Foo::PathRenameExtension)
|
82
|
+
assert_not_nil(Foo::PathSearchAndQualify)
|
83
|
+
assert_not_nil(Foo::PathSetDlgItemPath)
|
84
|
+
assert_not_nil(Foo::PathSkipRoot)
|
85
|
+
assert_not_nil(Foo::PathStripPath)
|
86
|
+
assert_not_nil(Foo::PathStripToRoot)
|
87
|
+
assert_not_nil(Foo::PathUndecorate)
|
88
|
+
assert_not_nil(Foo::PathUnExpandEnvStrings)
|
89
|
+
assert_not_nil(Foo::PathUnmakeSystemFolder)
|
90
|
+
assert_not_nil(Foo::PathUnquoteSpaces)
|
91
|
+
end
|
92
|
+
|
93
|
+
def teardown
|
94
|
+
@foo = nil
|
95
|
+
@path = nil
|
96
|
+
end
|
97
|
+
end
|
@@ -0,0 +1,43 @@
|
|
1
|
+
##################################################################
|
2
|
+
# tc_synchronize.rb
|
3
|
+
#
|
4
|
+
# Test case for the windows/synchronize package.
|
5
|
+
##################################################################
|
6
|
+
base = File.basename(Dir.pwd)
|
7
|
+
if base == 'test' || base =~ /windows-pr/
|
8
|
+
Dir.chdir '..' if base == 'test'
|
9
|
+
$LOAD_PATH.unshift Dir.pwd + '/lib'
|
10
|
+
Dir.chdir 'test' rescue nil
|
11
|
+
end
|
12
|
+
|
13
|
+
require "windows/synchronize"
|
14
|
+
require "test/unit"
|
15
|
+
|
16
|
+
class Foo
|
17
|
+
include Windows
|
18
|
+
end
|
19
|
+
|
20
|
+
class TC_Windows_Synchronize < Test::Unit::TestCase
|
21
|
+
def setup
|
22
|
+
@handle = (0.chr * 16).unpack('LLLL')
|
23
|
+
@foo = Foo.new
|
24
|
+
end
|
25
|
+
|
26
|
+
def test_numeric_constants
|
27
|
+
assert_not_nil(Foo::INFINITE)
|
28
|
+
end
|
29
|
+
|
30
|
+
def test_method_constants
|
31
|
+
assert_not_nil(Foo::WaitForSingleObject)
|
32
|
+
end
|
33
|
+
|
34
|
+
def test_wait_for_single_object
|
35
|
+
assert_respond_to(@foo, :wait_for_single_object)
|
36
|
+
assert_nothing_raised{ @foo.wait_for_single_object(@handle[0], 1) }
|
37
|
+
end
|
38
|
+
|
39
|
+
def teardown
|
40
|
+
@foo = nil
|
41
|
+
@handle = nil
|
42
|
+
end
|
43
|
+
end
|
data/test/ts_all.rb
ADDED
@@ -0,0 +1,10 @@
|
|
1
|
+
$LOAD_PATH.unshift(Dir.pwd)
|
2
|
+
$LOAD_PATH.unshift(Dir.pwd + '/lib')
|
3
|
+
$LOAD_PATH.unshift(Dir.pwd + '/lib/windows')
|
4
|
+
$LOAD_PATH.unshift(Dir.pwd + '/lib/windows/msvcrt')
|
5
|
+
$LOAD_PATH.unshift(Dir.pwd + '/test')
|
6
|
+
|
7
|
+
Dir.chdir('test') rescue nil
|
8
|
+
|
9
|
+
require 'tc_error'
|
10
|
+
require 'tc_msvcrt_buffer'
|
metadata
ADDED
@@ -0,0 +1,67 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
rubygems_version: 0.8.11
|
3
|
+
specification_version: 1
|
4
|
+
name: windows-pr
|
5
|
+
version: !ruby/object:Gem::Version
|
6
|
+
version: 0.1.0
|
7
|
+
date: 2006-04-05 00:00:00 -06:00
|
8
|
+
summary: Windows functions predefined via Win32API
|
9
|
+
require_paths:
|
10
|
+
- lib
|
11
|
+
email: djberg96@gmail.com
|
12
|
+
homepage: http://www.rubyforge.org/projects/win32utils
|
13
|
+
rubyforge_project:
|
14
|
+
description:
|
15
|
+
autorequire:
|
16
|
+
default_executable:
|
17
|
+
bindir: bin
|
18
|
+
has_rdoc: true
|
19
|
+
required_ruby_version: !ruby/object:Gem::Version::Requirement
|
20
|
+
requirements:
|
21
|
+
- - ">"
|
22
|
+
- !ruby/object:Gem::Version
|
23
|
+
version: 0.0.0
|
24
|
+
version:
|
25
|
+
platform: ruby
|
26
|
+
signing_key:
|
27
|
+
cert_chain:
|
28
|
+
authors:
|
29
|
+
- Daniel J. Berger
|
30
|
+
files:
|
31
|
+
- doc/conversion_guide.txt
|
32
|
+
- lib/windows/clipboard.rb
|
33
|
+
- lib/windows/device_io.rb
|
34
|
+
- lib/windows/error.rb
|
35
|
+
- lib/windows/file.rb
|
36
|
+
- lib/windows/handle.rb
|
37
|
+
- lib/windows/memory.rb
|
38
|
+
- lib/windows/path.rb
|
39
|
+
- lib/windows/sound.rb
|
40
|
+
- lib/windows/synchronize.rb
|
41
|
+
- test/ts_all.rb
|
42
|
+
- lib/windows/msvcrt/buffer.rb
|
43
|
+
- lib/windows/msvcrt/file.rb
|
44
|
+
- test/CVS
|
45
|
+
- test/tc_error.rb
|
46
|
+
- test/tc_msvcrt_buffer.rb
|
47
|
+
- test/tc_path.rb
|
48
|
+
- test/tc_synchronize.rb
|
49
|
+
- CHANGES
|
50
|
+
- CVS
|
51
|
+
- MANIFEST
|
52
|
+
- README
|
53
|
+
test_files:
|
54
|
+
- test/ts_all.rb
|
55
|
+
rdoc_options: []
|
56
|
+
|
57
|
+
extra_rdoc_files:
|
58
|
+
- README
|
59
|
+
- CHANGES
|
60
|
+
executables: []
|
61
|
+
|
62
|
+
extensions: []
|
63
|
+
|
64
|
+
requirements: []
|
65
|
+
|
66
|
+
dependencies: []
|
67
|
+
|