windows-pr 1.1.3 → 1.2.0
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.
- data/CHANGES +15 -0
- data/MANIFEST +65 -65
- data/README +149 -149
- data/Rakefile +37 -52
- data/doc/conversion_guide.txt +37 -37
- data/lib/windows/clipboard.rb +2 -0
- data/lib/windows/com.rb +2 -0
- data/lib/windows/com/accessibility.rb +12 -10
- data/lib/windows/com/automation.rb +149 -147
- data/lib/windows/com/variant.rb +24 -22
- data/lib/windows/console.rb +114 -112
- data/lib/windows/debug.rb +35 -33
- data/lib/windows/device_io.rb +248 -246
- data/lib/windows/directory.rb +2 -0
- data/lib/windows/error.rb +2 -0
- data/lib/windows/eventlog.rb +2 -0
- data/lib/windows/file.rb +264 -262
- data/lib/windows/file_mapping.rb +25 -23
- data/lib/windows/filesystem.rb +2 -0
- data/lib/windows/gdi/bitmap.rb +65 -63
- data/lib/windows/gdi/device_context.rb +46 -44
- data/lib/windows/gdi/metafile.rb +40 -38
- data/lib/windows/gdi/painting_drawing.rb +115 -113
- data/lib/windows/handle.rb +2 -0
- data/lib/windows/library.rb +2 -0
- data/lib/windows/limits.rb +34 -31
- data/lib/windows/mailslot.rb +2 -0
- data/lib/windows/memory.rb +2 -0
- data/lib/windows/msvcrt/buffer.rb +75 -73
- data/lib/windows/msvcrt/directory.rb +31 -29
- data/lib/windows/msvcrt/file.rb +47 -45
- data/lib/windows/msvcrt/io.rb +62 -60
- data/lib/windows/msvcrt/string.rb +2 -0
- data/lib/windows/msvcrt/time.rb +169 -167
- data/lib/windows/national.rb +580 -578
- data/lib/windows/network/management.rb +525 -523
- data/lib/windows/network/snmp.rb +92 -90
- data/lib/windows/network/winsock.rb +128 -126
- data/lib/windows/nio.rb +2 -0
- data/lib/windows/ntfs/winternl.rb +96 -82
- data/lib/windows/path.rb +143 -141
- data/lib/windows/pipe.rb +42 -40
- data/lib/windows/process.rb +2 -0
- data/lib/windows/registry.rb +171 -126
- data/lib/windows/security.rb +479 -477
- data/lib/windows/security/authentication.rb +32 -30
- data/lib/windows/service.rb +142 -140
- data/lib/windows/shell.rb +171 -169
- data/lib/windows/socket.rb +86 -0
- data/lib/windows/sound.rb +39 -37
- data/lib/windows/synchronize.rb +133 -131
- data/lib/windows/system_info.rb +4 -2
- data/lib/windows/thread.rb +2 -0
- data/lib/windows/time.rb +48 -46
- data/lib/windows/tool_helper.rb +36 -34
- data/lib/windows/unicode.rb +2 -0
- data/lib/windows/volume.rb +61 -59
- data/lib/windows/window.rb +81 -79
- data/lib/windows/window/classes.rb +59 -57
- data/lib/windows/window/dialog.rb +91 -89
- data/lib/windows/window/menu.rb +102 -100
- data/lib/windows/window/message.rb +297 -295
- data/lib/windows/window/properties.rb +20 -18
- data/lib/windows/window/timer.rb +19 -17
- data/lib/windows/wsa.rb +102 -0
- data/test/tc_clipboard.rb +41 -41
- data/test/tc_com.rb +32 -32
- data/test/tc_com_automation.rb +15 -15
- data/test/tc_console.rb +108 -108
- data/test/tc_debug.rb +48 -48
- data/test/tc_device_io.rb +29 -29
- data/test/tc_directory.rb +25 -25
- data/test/tc_error.rb +38 -50
- data/test/tc_eventlog.rb +58 -58
- data/test/tc_file.rb +67 -67
- data/test/tc_file_mapping.rb +38 -38
- data/test/tc_filesystem.rb +27 -27
- data/test/tc_gdi_bitmap.rb +25 -25
- data/test/tc_gdi_metafile.rb +23 -23
- data/test/tc_handle.rb +36 -36
- data/test/tc_library.rb +37 -37
- data/test/tc_limits.rb +34 -34
- data/test/tc_mailslot.rb +22 -22
- data/test/tc_memory.rb +44 -44
- data/test/tc_msvcrt_buffer.rb +59 -68
- data/test/tc_msvcrt_directory.rb +96 -98
- data/test/tc_msvcrt_file.rb +80 -80
- data/test/tc_msvcrt_io.rb +48 -48
- data/test/tc_msvcrt_string.rb +94 -93
- data/test/tc_msvcrt_time.rb +19 -29
- data/test/tc_national.rb +38 -38
- data/test/tc_network_management.rb +32 -32
- data/test/tc_network_snmp.rb +31 -31
- data/test/tc_network_winsock.rb +34 -34
- data/test/tc_nio.rb +32 -32
- data/test/tc_ntfs_winternl.rb +33 -18
- data/test/tc_path.rb +90 -90
- data/test/tc_pipe.rb +53 -53
- data/test/tc_process.rb +24 -24
- data/test/tc_registry.rb +29 -29
- data/test/tc_security.rb +104 -104
- data/test/tc_security_authentication.rb +34 -34
- data/test/tc_service.rb +57 -57
- data/test/tc_shell.rb +34 -34
- data/test/tc_socket.rb +20 -0
- data/test/tc_sound.rb +37 -37
- data/test/tc_synchronize.rb +75 -75
- data/test/tc_system_info.rb +33 -43
- data/test/tc_thread.rb +29 -29
- data/test/tc_time.rb +32 -32
- data/test/tc_tool_helper.rb +29 -29
- data/test/tc_unicode.rb +62 -62
- data/test/tc_volume.rb +47 -47
- data/test/tc_window.rb +45 -45
- data/test/tc_window_classes.rb +33 -33
- data/test/tc_window_dialog.rb +33 -33
- data/test/tc_window_menu.rb +29 -29
- data/test/tc_window_message.rb +33 -33
- data/test/tc_window_properties.rb +29 -29
- data/test/tc_window_timer.rb +29 -29
- data/test/tc_wsa.rb +19 -0
- data/windows-pr.gemspec +1 -1
- metadata +13 -7
data/test/tc_national.rb
CHANGED
|
@@ -1,38 +1,38 @@
|
|
|
1
|
-
#####################################################################
|
|
2
|
-
# tc_national.rb
|
|
3
|
-
#
|
|
4
|
-
# Test case for the Windows::National module.
|
|
5
|
-
#####################################################################
|
|
6
|
-
require 'windows/national'
|
|
7
|
-
require 'test/unit'
|
|
8
|
-
|
|
9
|
-
class NationalFoo
|
|
10
|
-
include Windows::National
|
|
11
|
-
end
|
|
12
|
-
|
|
13
|
-
class TC_Windows_National < Test::Unit::TestCase
|
|
14
|
-
def setup
|
|
15
|
-
@foo = NationalFoo.new
|
|
16
|
-
end
|
|
17
|
-
|
|
18
|
-
def test_numeric_constants
|
|
19
|
-
assert_equal(2048, NationalFoo::LANG_SYSTEM_DEFAULT)
|
|
20
|
-
assert_equal(1024, NationalFoo::LANG_USER_DEFAULT)
|
|
21
|
-
assert_equal(2048, NationalFoo::LOCALE_SYSTEM_DEFAULT)
|
|
22
|
-
assert_equal(1024, NationalFoo::LOCALE_USER_DEFAULT)
|
|
23
|
-
assert_equal(8323072, NationalFoo::LOCALE_INVARIANT)
|
|
24
|
-
end
|
|
25
|
-
|
|
26
|
-
def test_method_constants
|
|
27
|
-
assert_not_nil(NationalFoo::GetACP)
|
|
28
|
-
assert_not_nil(NationalFoo::GetDateFormat)
|
|
29
|
-
assert_not_nil(NationalFoo::GetLocaleInfo)
|
|
30
|
-
assert_not_nil(NationalFoo::GetSystemDefaultLangID)
|
|
31
|
-
assert_not_nil(NationalFoo::GetUserDefaultLangID)
|
|
32
|
-
assert_not_nil(NationalFoo::GetUserDefaultLCID)
|
|
33
|
-
end
|
|
34
|
-
|
|
35
|
-
def teardown
|
|
36
|
-
@foo = nil
|
|
37
|
-
end
|
|
38
|
-
end
|
|
1
|
+
#####################################################################
|
|
2
|
+
# tc_national.rb
|
|
3
|
+
#
|
|
4
|
+
# Test case for the Windows::National module.
|
|
5
|
+
#####################################################################
|
|
6
|
+
require 'windows/national'
|
|
7
|
+
require 'test/unit'
|
|
8
|
+
|
|
9
|
+
class NationalFoo
|
|
10
|
+
include Windows::National
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
class TC_Windows_National < Test::Unit::TestCase
|
|
14
|
+
def setup
|
|
15
|
+
@foo = NationalFoo.new
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
def test_numeric_constants
|
|
19
|
+
assert_equal(2048, NationalFoo::LANG_SYSTEM_DEFAULT)
|
|
20
|
+
assert_equal(1024, NationalFoo::LANG_USER_DEFAULT)
|
|
21
|
+
assert_equal(2048, NationalFoo::LOCALE_SYSTEM_DEFAULT)
|
|
22
|
+
assert_equal(1024, NationalFoo::LOCALE_USER_DEFAULT)
|
|
23
|
+
assert_equal(8323072, NationalFoo::LOCALE_INVARIANT)
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
def test_method_constants
|
|
27
|
+
assert_not_nil(NationalFoo::GetACP)
|
|
28
|
+
assert_not_nil(NationalFoo::GetDateFormat)
|
|
29
|
+
assert_not_nil(NationalFoo::GetLocaleInfo)
|
|
30
|
+
assert_not_nil(NationalFoo::GetSystemDefaultLangID)
|
|
31
|
+
assert_not_nil(NationalFoo::GetUserDefaultLangID)
|
|
32
|
+
assert_not_nil(NationalFoo::GetUserDefaultLCID)
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
def teardown
|
|
36
|
+
@foo = nil
|
|
37
|
+
end
|
|
38
|
+
end
|
|
@@ -1,32 +1,32 @@
|
|
|
1
|
-
#####################################################################
|
|
2
|
-
# tc_network_management.rb
|
|
3
|
-
#
|
|
4
|
-
# Test case for the Windows::NetworkManagement module.
|
|
5
|
-
#####################################################################
|
|
6
|
-
require 'windows/network/management'
|
|
7
|
-
require 'test/unit'
|
|
8
|
-
|
|
9
|
-
class NetworkManagementFoo
|
|
10
|
-
include Windows::Network::Management
|
|
11
|
-
end
|
|
12
|
-
|
|
13
|
-
class TC_Windows_Network_Management < Test::Unit::TestCase
|
|
14
|
-
def setup
|
|
15
|
-
@foo = NetworkManagementFoo.new
|
|
16
|
-
end
|
|
17
|
-
|
|
18
|
-
def test_numeric_constants
|
|
19
|
-
assert_equal(0, NetworkManagementFoo::NERR_Success)
|
|
20
|
-
assert_equal(0xFFFFFFFF, NetworkManagementFoo::MAX_PREFERRED_LENGTH)
|
|
21
|
-
assert_equal(0x00000001, NetworkManagementFoo::SV_TYPE_WORKSTATION)
|
|
22
|
-
end
|
|
23
|
-
|
|
24
|
-
def test_method_constants
|
|
25
|
-
assert_not_nil(NetworkManagementFoo::NetAlertRaise)
|
|
26
|
-
assert_not_nil(NetworkManagementFoo::NetAlertRaiseEx)
|
|
27
|
-
end
|
|
28
|
-
|
|
29
|
-
def teardown
|
|
30
|
-
@foo = nil
|
|
31
|
-
end
|
|
32
|
-
end
|
|
1
|
+
#####################################################################
|
|
2
|
+
# tc_network_management.rb
|
|
3
|
+
#
|
|
4
|
+
# Test case for the Windows::NetworkManagement module.
|
|
5
|
+
#####################################################################
|
|
6
|
+
require 'windows/network/management'
|
|
7
|
+
require 'test/unit'
|
|
8
|
+
|
|
9
|
+
class NetworkManagementFoo
|
|
10
|
+
include Windows::Network::Management
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
class TC_Windows_Network_Management < Test::Unit::TestCase
|
|
14
|
+
def setup
|
|
15
|
+
@foo = NetworkManagementFoo.new
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
def test_numeric_constants
|
|
19
|
+
assert_equal(0, NetworkManagementFoo::NERR_Success)
|
|
20
|
+
assert_equal(0xFFFFFFFF, NetworkManagementFoo::MAX_PREFERRED_LENGTH)
|
|
21
|
+
assert_equal(0x00000001, NetworkManagementFoo::SV_TYPE_WORKSTATION)
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
def test_method_constants
|
|
25
|
+
assert_not_nil(NetworkManagementFoo::NetAlertRaise)
|
|
26
|
+
assert_not_nil(NetworkManagementFoo::NetAlertRaiseEx)
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
def teardown
|
|
30
|
+
@foo = nil
|
|
31
|
+
end
|
|
32
|
+
end
|
data/test/tc_network_snmp.rb
CHANGED
|
@@ -1,31 +1,31 @@
|
|
|
1
|
-
#####################################################################
|
|
2
|
-
# tc_network_snmp.rb
|
|
3
|
-
#
|
|
4
|
-
# Test case for the Windows::NetworkSNMP module.
|
|
5
|
-
#####################################################################
|
|
6
|
-
require 'windows/network/snmp'
|
|
7
|
-
require 'test/unit'
|
|
8
|
-
|
|
9
|
-
class NetworkSNMPFoo
|
|
10
|
-
include Windows::Network::SNMP
|
|
11
|
-
end
|
|
12
|
-
|
|
13
|
-
class TC_Windows_Network_SNMP < Test::Unit::TestCase
|
|
14
|
-
def setup
|
|
15
|
-
@foo = NetworkSNMPFoo.new
|
|
16
|
-
end
|
|
17
|
-
|
|
18
|
-
def test_numeric_constants
|
|
19
|
-
assert_equal(0, NetworkSNMPFoo::SNMPAPI_FAILURE)
|
|
20
|
-
assert_equal(1, NetworkSNMPFoo::SNMPAPI_SUCCESS)
|
|
21
|
-
end
|
|
22
|
-
|
|
23
|
-
def test_method_constants
|
|
24
|
-
assert_not_nil(NetworkSNMPFoo::SnmpCleanup)
|
|
25
|
-
assert_not_nil(NetworkSNMPFoo::SnmpClose)
|
|
26
|
-
end
|
|
27
|
-
|
|
28
|
-
def teardown
|
|
29
|
-
@foo = nil
|
|
30
|
-
end
|
|
31
|
-
end
|
|
1
|
+
#####################################################################
|
|
2
|
+
# tc_network_snmp.rb
|
|
3
|
+
#
|
|
4
|
+
# Test case for the Windows::NetworkSNMP module.
|
|
5
|
+
#####################################################################
|
|
6
|
+
require 'windows/network/snmp'
|
|
7
|
+
require 'test/unit'
|
|
8
|
+
|
|
9
|
+
class NetworkSNMPFoo
|
|
10
|
+
include Windows::Network::SNMP
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
class TC_Windows_Network_SNMP < Test::Unit::TestCase
|
|
14
|
+
def setup
|
|
15
|
+
@foo = NetworkSNMPFoo.new
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
def test_numeric_constants
|
|
19
|
+
assert_equal(0, NetworkSNMPFoo::SNMPAPI_FAILURE)
|
|
20
|
+
assert_equal(1, NetworkSNMPFoo::SNMPAPI_SUCCESS)
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
def test_method_constants
|
|
24
|
+
assert_not_nil(NetworkSNMPFoo::SnmpCleanup)
|
|
25
|
+
assert_not_nil(NetworkSNMPFoo::SnmpClose)
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
def teardown
|
|
29
|
+
@foo = nil
|
|
30
|
+
end
|
|
31
|
+
end
|
data/test/tc_network_winsock.rb
CHANGED
|
@@ -1,34 +1,34 @@
|
|
|
1
|
-
#####################################################################
|
|
2
|
-
# tc_network_winsock.rb
|
|
3
|
-
#
|
|
4
|
-
# Test case for the Windows::Winsock module.
|
|
5
|
-
#####################################################################
|
|
6
|
-
require 'windows/network/winsock'
|
|
7
|
-
require 'test/unit'
|
|
8
|
-
|
|
9
|
-
class WinsockFoo
|
|
10
|
-
include Windows::Network::Winsock
|
|
11
|
-
end
|
|
12
|
-
|
|
13
|
-
class TC_Windows_Network_Winsock < Test::Unit::TestCase
|
|
14
|
-
def setup
|
|
15
|
-
@foo = WinsockFoo.new
|
|
16
|
-
end
|
|
17
|
-
|
|
18
|
-
def test_numeric_constants
|
|
19
|
-
assert_equal(0, WinsockFoo::NS_DEFAULT)
|
|
20
|
-
end
|
|
21
|
-
|
|
22
|
-
def test_method_constants
|
|
23
|
-
assert_not_nil(WinsockFoo::GetTypeByName)
|
|
24
|
-
end
|
|
25
|
-
|
|
26
|
-
def test_method_mixins
|
|
27
|
-
assert_respond_to(@foo, :gethostbyname)
|
|
28
|
-
assert_respond_to(@foo, :GetTypeByName)
|
|
29
|
-
end
|
|
30
|
-
|
|
31
|
-
def teardown
|
|
32
|
-
@foo = nil
|
|
33
|
-
end
|
|
34
|
-
end
|
|
1
|
+
#####################################################################
|
|
2
|
+
# tc_network_winsock.rb
|
|
3
|
+
#
|
|
4
|
+
# Test case for the Windows::Winsock module.
|
|
5
|
+
#####################################################################
|
|
6
|
+
require 'windows/network/winsock'
|
|
7
|
+
require 'test/unit'
|
|
8
|
+
|
|
9
|
+
class WinsockFoo
|
|
10
|
+
include Windows::Network::Winsock
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
class TC_Windows_Network_Winsock < Test::Unit::TestCase
|
|
14
|
+
def setup
|
|
15
|
+
@foo = WinsockFoo.new
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
def test_numeric_constants
|
|
19
|
+
assert_equal(0, WinsockFoo::NS_DEFAULT)
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
def test_method_constants
|
|
23
|
+
assert_not_nil(WinsockFoo::GetTypeByName)
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
def test_method_mixins
|
|
27
|
+
assert_respond_to(@foo, :gethostbyname)
|
|
28
|
+
assert_respond_to(@foo, :GetTypeByName)
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
def teardown
|
|
32
|
+
@foo = nil
|
|
33
|
+
end
|
|
34
|
+
end
|
data/test/tc_nio.rb
CHANGED
|
@@ -1,32 +1,32 @@
|
|
|
1
|
-
#####################################################################
|
|
2
|
-
# tc_nio.rb
|
|
3
|
-
#
|
|
4
|
-
# Test case for the Windows::NIO module.
|
|
5
|
-
#####################################################################
|
|
6
|
-
require 'windows/nio'
|
|
7
|
-
require 'test/unit'
|
|
8
|
-
|
|
9
|
-
class NIOFoo
|
|
10
|
-
include Windows::NIO
|
|
11
|
-
end
|
|
12
|
-
|
|
13
|
-
class TC_Windows_NIO < Test::Unit::TestCase
|
|
14
|
-
def setup
|
|
15
|
-
@foo = NIOFoo.new
|
|
16
|
-
end
|
|
17
|
-
|
|
18
|
-
def test_numeric_constants
|
|
19
|
-
assert_equal(0, NIOFoo::OF_READ)
|
|
20
|
-
assert_equal(1, NIOFoo::OF_WRITE)
|
|
21
|
-
assert_equal(2, NIOFoo::OF_READWRITE)
|
|
22
|
-
end
|
|
23
|
-
|
|
24
|
-
def test_method_constants
|
|
25
|
-
assert_not_nil(NIOFoo::CancelIo)
|
|
26
|
-
assert_not_nil(NIOFoo::ReadFileScatter)
|
|
27
|
-
end
|
|
28
|
-
|
|
29
|
-
def teardown
|
|
30
|
-
@foo = nil
|
|
31
|
-
end
|
|
32
|
-
end
|
|
1
|
+
#####################################################################
|
|
2
|
+
# tc_nio.rb
|
|
3
|
+
#
|
|
4
|
+
# Test case for the Windows::NIO module.
|
|
5
|
+
#####################################################################
|
|
6
|
+
require 'windows/nio'
|
|
7
|
+
require 'test/unit'
|
|
8
|
+
|
|
9
|
+
class NIOFoo
|
|
10
|
+
include Windows::NIO
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
class TC_Windows_NIO < Test::Unit::TestCase
|
|
14
|
+
def setup
|
|
15
|
+
@foo = NIOFoo.new
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
def test_numeric_constants
|
|
19
|
+
assert_equal(0, NIOFoo::OF_READ)
|
|
20
|
+
assert_equal(1, NIOFoo::OF_WRITE)
|
|
21
|
+
assert_equal(2, NIOFoo::OF_READWRITE)
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
def test_method_constants
|
|
25
|
+
assert_not_nil(NIOFoo::CancelIo)
|
|
26
|
+
assert_not_nil(NIOFoo::ReadFileScatter)
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
def teardown
|
|
30
|
+
@foo = nil
|
|
31
|
+
end
|
|
32
|
+
end
|
data/test/tc_ntfs_winternl.rb
CHANGED
|
@@ -6,24 +6,39 @@
|
|
|
6
6
|
require "windows/ntfs/winternl"
|
|
7
7
|
require "test/unit"
|
|
8
8
|
|
|
9
|
-
class WinternlFoo
|
|
10
|
-
include Windows::NTFS::Winternl
|
|
11
|
-
end
|
|
12
|
-
|
|
13
9
|
class TC_Windows_NTFS_Winternl < Test::Unit::TestCase
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
end
|
|
21
|
-
|
|
22
|
-
def test_method_constants
|
|
23
|
-
assert_not_nil(WinternlFoo::NtQueryInformationFile)
|
|
24
|
-
end
|
|
10
|
+
include Windows::NTFS::Winternl
|
|
11
|
+
|
|
12
|
+
def setup
|
|
13
|
+
@name = "winternl_test.txt"
|
|
14
|
+
@handle = File.open(@name, 'w')
|
|
15
|
+
end
|
|
25
16
|
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
17
|
+
def test_numeric_constants
|
|
18
|
+
assert_equal(8, FileAccessInformation)
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
def test_methods_defined
|
|
22
|
+
assert(self.respond_to?(:NtQueryInformationFile, true))
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
def test_get_final_path_name_by_handle
|
|
26
|
+
assert(self.respond_to?(:GetFinalPathNameByHandle, true))
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
def test_get_final_path_name_by_handle_returns_expected_result
|
|
30
|
+
buf = 0.chr * 260
|
|
31
|
+
res = nil
|
|
32
|
+
assert_nothing_raised{
|
|
33
|
+
res = GetFinalPathNameByHandle(@handle, buf, buf.size, 2)
|
|
34
|
+
}
|
|
35
|
+
assert_kind_of(Fixnum, res)
|
|
36
|
+
assert_equal(true, File.basename(buf) == @name)
|
|
37
|
+
end
|
|
38
|
+
|
|
39
|
+
def teardown
|
|
40
|
+
@handle.close if @handle
|
|
41
|
+
File.delete(@name) if File.exists?(@name)
|
|
42
|
+
@name = nil
|
|
43
|
+
end
|
|
29
44
|
end
|
data/test/tc_path.rb
CHANGED
|
@@ -1,90 +1,90 @@
|
|
|
1
|
-
#####################################################################
|
|
2
|
-
# tc_path.rb
|
|
3
|
-
#
|
|
4
|
-
# Test case for the Windows::Path module.
|
|
5
|
-
#####################################################################
|
|
6
|
-
require "windows/path"
|
|
7
|
-
require "test/unit"
|
|
8
|
-
|
|
9
|
-
class PathFoo
|
|
10
|
-
include Windows::Path
|
|
11
|
-
end
|
|
12
|
-
|
|
13
|
-
class TC_Windows_Path < Test::Unit::TestCase
|
|
14
|
-
def setup
|
|
15
|
-
@foo = PathFoo.new
|
|
16
|
-
@path = "C:\\"
|
|
17
|
-
end
|
|
18
|
-
|
|
19
|
-
def test_numeric_constants
|
|
20
|
-
assert_equal(0x0000, PathFoo::GCT_INVALID)
|
|
21
|
-
assert_equal(0x0001, PathFoo::GCT_LFNCHAR)
|
|
22
|
-
assert_equal(0x0002, PathFoo::GCT_SHORTCHAR)
|
|
23
|
-
assert_equal(0x0004, PathFoo::GCT_WILD)
|
|
24
|
-
assert_equal(0x0008, PathFoo::GCT_SEPARATOR)
|
|
25
|
-
end
|
|
26
|
-
|
|
27
|
-
def test_method_constants
|
|
28
|
-
assert_not_nil(PathFoo::PathAddBackslash)
|
|
29
|
-
assert_not_nil(PathFoo::PathAddExtension)
|
|
30
|
-
assert_not_nil(PathFoo::PathAppend)
|
|
31
|
-
assert_not_nil(PathFoo::PathBuildRoot)
|
|
32
|
-
assert_not_nil(PathFoo::PathCanonicalize)
|
|
33
|
-
assert_not_nil(PathFoo::PathCombine)
|
|
34
|
-
assert_not_nil(PathFoo::PathCommonPrefix)
|
|
35
|
-
assert_not_nil(PathFoo::PathCompactPath)
|
|
36
|
-
assert_not_nil(PathFoo::PathCompactPathEx)
|
|
37
|
-
assert_not_nil(PathFoo::PathCreateFromUrl)
|
|
38
|
-
assert_not_nil(PathFoo::PathFileExists)
|
|
39
|
-
assert_not_nil(PathFoo::PathFindExtension)
|
|
40
|
-
assert_not_nil(PathFoo::PathFindFileName)
|
|
41
|
-
assert_not_nil(PathFoo::PathFindNextComponent)
|
|
42
|
-
assert_not_nil(PathFoo::PathFindOnPath)
|
|
43
|
-
assert_not_nil(PathFoo::PathFindSuffixArray)
|
|
44
|
-
assert_not_nil(PathFoo::PathGetArgs)
|
|
45
|
-
assert_not_nil(PathFoo::PathGetCharType)
|
|
46
|
-
assert_not_nil(PathFoo::PathGetDriveNumber)
|
|
47
|
-
assert_not_nil(PathFoo::PathIsContentType)
|
|
48
|
-
assert_not_nil(PathFoo::PathIsDirectory)
|
|
49
|
-
assert_not_nil(PathFoo::PathIsDirectoryEmpty)
|
|
50
|
-
assert_not_nil(PathFoo::PathIsFileSpec)
|
|
51
|
-
#assert_not_nil(PathFoo::PathIsHTMLFile)
|
|
52
|
-
assert_not_nil(PathFoo::PathIsLFNFileSpec)
|
|
53
|
-
assert_not_nil(PathFoo::PathIsNetworkPath)
|
|
54
|
-
assert_not_nil(PathFoo::PathIsPrefix)
|
|
55
|
-
assert_not_nil(PathFoo::PathIsRelative)
|
|
56
|
-
assert_not_nil(PathFoo::PathIsRoot)
|
|
57
|
-
assert_not_nil(PathFoo::PathIsSameRoot)
|
|
58
|
-
assert_not_nil(PathFoo::PathIsSystemFolder)
|
|
59
|
-
assert_not_nil(PathFoo::PathIsUNC)
|
|
60
|
-
assert_not_nil(PathFoo::PathIsUNCServer)
|
|
61
|
-
assert_not_nil(PathFoo::PathIsUNCServerShare)
|
|
62
|
-
assert_not_nil(PathFoo::PathIsURL)
|
|
63
|
-
assert_not_nil(PathFoo::PathMakePretty)
|
|
64
|
-
assert_not_nil(PathFoo::PathMakeSystemFolder)
|
|
65
|
-
assert_not_nil(PathFoo::PathMatchSpec)
|
|
66
|
-
assert_not_nil(PathFoo::PathParseIconLocation)
|
|
67
|
-
assert_not_nil(PathFoo::PathQuoteSpaces)
|
|
68
|
-
assert_not_nil(PathFoo::PathRelativePathTo)
|
|
69
|
-
assert_not_nil(PathFoo::PathRemoveArgs)
|
|
70
|
-
assert_not_nil(PathFoo::PathRemoveBackslash)
|
|
71
|
-
assert_not_nil(PathFoo::PathRemoveBlanks)
|
|
72
|
-
assert_not_nil(PathFoo::PathRemoveExtension)
|
|
73
|
-
assert_not_nil(PathFoo::PathRemoveFileSpec)
|
|
74
|
-
assert_not_nil(PathFoo::PathRenameExtension)
|
|
75
|
-
assert_not_nil(PathFoo::PathSearchAndQualify)
|
|
76
|
-
assert_not_nil(PathFoo::PathSetDlgItemPath)
|
|
77
|
-
assert_not_nil(PathFoo::PathSkipRoot)
|
|
78
|
-
assert_not_nil(PathFoo::PathStripPath)
|
|
79
|
-
assert_not_nil(PathFoo::PathStripToRoot)
|
|
80
|
-
assert_not_nil(PathFoo::PathUndecorate)
|
|
81
|
-
assert_not_nil(PathFoo::PathUnExpandEnvStrings)
|
|
82
|
-
assert_not_nil(PathFoo::PathUnmakeSystemFolder)
|
|
83
|
-
assert_not_nil(PathFoo::PathUnquoteSpaces)
|
|
84
|
-
end
|
|
85
|
-
|
|
86
|
-
def teardown
|
|
87
|
-
@foo = nil
|
|
88
|
-
@path = nil
|
|
89
|
-
end
|
|
90
|
-
end
|
|
1
|
+
#####################################################################
|
|
2
|
+
# tc_path.rb
|
|
3
|
+
#
|
|
4
|
+
# Test case for the Windows::Path module.
|
|
5
|
+
#####################################################################
|
|
6
|
+
require "windows/path"
|
|
7
|
+
require "test/unit"
|
|
8
|
+
|
|
9
|
+
class PathFoo
|
|
10
|
+
include Windows::Path
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
class TC_Windows_Path < Test::Unit::TestCase
|
|
14
|
+
def setup
|
|
15
|
+
@foo = PathFoo.new
|
|
16
|
+
@path = "C:\\"
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
def test_numeric_constants
|
|
20
|
+
assert_equal(0x0000, PathFoo::GCT_INVALID)
|
|
21
|
+
assert_equal(0x0001, PathFoo::GCT_LFNCHAR)
|
|
22
|
+
assert_equal(0x0002, PathFoo::GCT_SHORTCHAR)
|
|
23
|
+
assert_equal(0x0004, PathFoo::GCT_WILD)
|
|
24
|
+
assert_equal(0x0008, PathFoo::GCT_SEPARATOR)
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
def test_method_constants
|
|
28
|
+
assert_not_nil(PathFoo::PathAddBackslash)
|
|
29
|
+
assert_not_nil(PathFoo::PathAddExtension)
|
|
30
|
+
assert_not_nil(PathFoo::PathAppend)
|
|
31
|
+
assert_not_nil(PathFoo::PathBuildRoot)
|
|
32
|
+
assert_not_nil(PathFoo::PathCanonicalize)
|
|
33
|
+
assert_not_nil(PathFoo::PathCombine)
|
|
34
|
+
assert_not_nil(PathFoo::PathCommonPrefix)
|
|
35
|
+
assert_not_nil(PathFoo::PathCompactPath)
|
|
36
|
+
assert_not_nil(PathFoo::PathCompactPathEx)
|
|
37
|
+
assert_not_nil(PathFoo::PathCreateFromUrl)
|
|
38
|
+
assert_not_nil(PathFoo::PathFileExists)
|
|
39
|
+
assert_not_nil(PathFoo::PathFindExtension)
|
|
40
|
+
assert_not_nil(PathFoo::PathFindFileName)
|
|
41
|
+
assert_not_nil(PathFoo::PathFindNextComponent)
|
|
42
|
+
assert_not_nil(PathFoo::PathFindOnPath)
|
|
43
|
+
assert_not_nil(PathFoo::PathFindSuffixArray)
|
|
44
|
+
assert_not_nil(PathFoo::PathGetArgs)
|
|
45
|
+
assert_not_nil(PathFoo::PathGetCharType)
|
|
46
|
+
assert_not_nil(PathFoo::PathGetDriveNumber)
|
|
47
|
+
assert_not_nil(PathFoo::PathIsContentType)
|
|
48
|
+
assert_not_nil(PathFoo::PathIsDirectory)
|
|
49
|
+
assert_not_nil(PathFoo::PathIsDirectoryEmpty)
|
|
50
|
+
assert_not_nil(PathFoo::PathIsFileSpec)
|
|
51
|
+
#assert_not_nil(PathFoo::PathIsHTMLFile)
|
|
52
|
+
assert_not_nil(PathFoo::PathIsLFNFileSpec)
|
|
53
|
+
assert_not_nil(PathFoo::PathIsNetworkPath)
|
|
54
|
+
assert_not_nil(PathFoo::PathIsPrefix)
|
|
55
|
+
assert_not_nil(PathFoo::PathIsRelative)
|
|
56
|
+
assert_not_nil(PathFoo::PathIsRoot)
|
|
57
|
+
assert_not_nil(PathFoo::PathIsSameRoot)
|
|
58
|
+
assert_not_nil(PathFoo::PathIsSystemFolder)
|
|
59
|
+
assert_not_nil(PathFoo::PathIsUNC)
|
|
60
|
+
assert_not_nil(PathFoo::PathIsUNCServer)
|
|
61
|
+
assert_not_nil(PathFoo::PathIsUNCServerShare)
|
|
62
|
+
assert_not_nil(PathFoo::PathIsURL)
|
|
63
|
+
assert_not_nil(PathFoo::PathMakePretty)
|
|
64
|
+
assert_not_nil(PathFoo::PathMakeSystemFolder)
|
|
65
|
+
assert_not_nil(PathFoo::PathMatchSpec)
|
|
66
|
+
assert_not_nil(PathFoo::PathParseIconLocation)
|
|
67
|
+
assert_not_nil(PathFoo::PathQuoteSpaces)
|
|
68
|
+
assert_not_nil(PathFoo::PathRelativePathTo)
|
|
69
|
+
assert_not_nil(PathFoo::PathRemoveArgs)
|
|
70
|
+
assert_not_nil(PathFoo::PathRemoveBackslash)
|
|
71
|
+
assert_not_nil(PathFoo::PathRemoveBlanks)
|
|
72
|
+
assert_not_nil(PathFoo::PathRemoveExtension)
|
|
73
|
+
assert_not_nil(PathFoo::PathRemoveFileSpec)
|
|
74
|
+
assert_not_nil(PathFoo::PathRenameExtension)
|
|
75
|
+
assert_not_nil(PathFoo::PathSearchAndQualify)
|
|
76
|
+
assert_not_nil(PathFoo::PathSetDlgItemPath)
|
|
77
|
+
assert_not_nil(PathFoo::PathSkipRoot)
|
|
78
|
+
assert_not_nil(PathFoo::PathStripPath)
|
|
79
|
+
assert_not_nil(PathFoo::PathStripToRoot)
|
|
80
|
+
assert_not_nil(PathFoo::PathUndecorate)
|
|
81
|
+
assert_not_nil(PathFoo::PathUnExpandEnvStrings)
|
|
82
|
+
assert_not_nil(PathFoo::PathUnmakeSystemFolder)
|
|
83
|
+
assert_not_nil(PathFoo::PathUnquoteSpaces)
|
|
84
|
+
end
|
|
85
|
+
|
|
86
|
+
def teardown
|
|
87
|
+
@foo = nil
|
|
88
|
+
@path = nil
|
|
89
|
+
end
|
|
90
|
+
end
|