windows-pr 0.7.0 → 0.7.1

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/test/tc_library.rb CHANGED
@@ -3,42 +3,35 @@
3
3
  #
4
4
  # Test case for the Windows::Library module.
5
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
6
  require 'windows/library'
14
7
  require 'test/unit'
15
8
 
16
- class Foo
9
+ class LibraryFoo
17
10
  include Windows::Library
18
11
  end
19
12
 
20
13
  class TC_Windows_Library < Test::Unit::TestCase
21
14
  def setup
22
- @foo = Foo.new
15
+ @LibraryFoo = LibraryFoo.new
23
16
  end
24
17
 
25
18
  def test_numeric_constants
26
- assert_equal(0, Foo::DLL_PROCESS_DETACH)
27
- assert_equal(1, Foo::DLL_PROCESS_ATTACH)
28
- assert_equal(2, Foo::DLL_THREAD_ATTACH)
29
- assert_equal(3, Foo::DLL_THREAD_DETACH)
19
+ assert_equal(0, LibraryFoo::DLL_PROCESS_DETACH)
20
+ assert_equal(1, LibraryFoo::DLL_PROCESS_ATTACH)
21
+ assert_equal(2, LibraryFoo::DLL_THREAD_ATTACH)
22
+ assert_equal(3, LibraryFoo::DLL_THREAD_DETACH)
30
23
  end
31
24
 
32
25
  def test_method_constants
33
- assert_not_nil(Foo::FreeLibrary)
34
- assert_not_nil(Foo::GetModuleFileName)
35
- assert_not_nil(Foo::GetModuleHandle)
36
- assert_not_nil(Foo::LoadLibrary)
37
- assert_not_nil(Foo::LoadLibraryEx)
38
- assert_not_nil(Foo::LoadModule)
26
+ assert_not_nil(LibraryFoo::FreeLibrary)
27
+ assert_not_nil(LibraryFoo::GetModuleFileName)
28
+ assert_not_nil(LibraryFoo::GetModuleHandle)
29
+ assert_not_nil(LibraryFoo::LoadLibrary)
30
+ assert_not_nil(LibraryFoo::LoadLibraryEx)
31
+ assert_not_nil(LibraryFoo::LoadModule)
39
32
  end
40
33
 
41
34
  def teardown
42
- @foo = nil
35
+ @LibraryFoo = nil
43
36
  end
44
37
  end
data/test/tc_memory.rb CHANGED
@@ -3,45 +3,38 @@
3
3
  #
4
4
  # Test case for the Windows::Memory module.
5
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
6
  require 'windows/memory'
14
7
  require 'test/unit'
15
8
 
16
- class Foo
9
+ class MemoryFoo
17
10
  include Windows::Memory
18
11
  end
19
12
 
20
- class TC_Windows_Path < Test::Unit::TestCase
13
+ class TC_Windows_Memory < Test::Unit::TestCase
21
14
  def setup
22
- @foo = Foo.new
15
+ @foo = MemoryFoo.new
23
16
  @path = "C:\\"
24
17
  end
25
18
 
26
19
  def test_numeric_constants
27
- assert_not_nil(Foo::GHND)
28
- assert_not_nil(Foo::GMEM_FIXED)
29
- assert_not_nil(Foo::GMEM_MOVABLE)
30
- assert_not_nil(Foo::GMEM_ZEROINIT)
31
- assert_not_nil(Foo::GPTR)
20
+ assert_not_nil(MemoryFoo::GHND)
21
+ assert_not_nil(MemoryFoo::GMEM_FIXED)
22
+ assert_not_nil(MemoryFoo::GMEM_MOVABLE)
23
+ assert_not_nil(MemoryFoo::GMEM_ZEROINIT)
24
+ assert_not_nil(MemoryFoo::GPTR)
32
25
  end
33
26
 
34
27
  def test_method_constants
35
- assert_not_nil(Foo::GlobalAlloc)
36
- assert_not_nil(Foo::GlobalFlags)
37
- assert_not_nil(Foo::GlobalFree)
38
- assert_not_nil(Foo::GlobalHandle)
39
- assert_not_nil(Foo::GlobalLock)
40
- assert_not_nil(Foo::GlobalMemoryStatus)
41
- assert_not_nil(Foo::GlobalMemoryStatusEx)
42
- assert_not_nil(Foo::GlobalReAlloc)
43
- assert_not_nil(Foo::GlobalSize)
44
- assert_not_nil(Foo::GlobalUnlock)
28
+ assert_not_nil(MemoryFoo::GlobalAlloc)
29
+ assert_not_nil(MemoryFoo::GlobalFlags)
30
+ assert_not_nil(MemoryFoo::GlobalFree)
31
+ assert_not_nil(MemoryFoo::GlobalHandle)
32
+ assert_not_nil(MemoryFoo::GlobalLock)
33
+ assert_not_nil(MemoryFoo::GlobalMemoryStatus)
34
+ assert_not_nil(MemoryFoo::GlobalMemoryStatusEx)
35
+ assert_not_nil(MemoryFoo::GlobalReAlloc)
36
+ assert_not_nil(MemoryFoo::GlobalSize)
37
+ assert_not_nil(MemoryFoo::GlobalUnlock)
45
38
  end
46
39
 
47
40
  def teardown
@@ -3,34 +3,27 @@
3
3
  #
4
4
  # Test case for the Windows::MSVCRT::Buffer module.
5
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
6
  require "windows/msvcrt/buffer"
14
7
  require "test/unit"
15
8
 
16
- class Foo
9
+ class BufferFoo
17
10
  include Windows::MSVCRT::Buffer
18
11
  end
19
12
 
20
13
  class TC_Windows_MSVCRT_Buffer < Test::Unit::TestCase
21
14
  def setup
22
- @foo = Foo.new
15
+ @foo = BufferFoo.new
23
16
  end
24
17
 
25
18
  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)
19
+ assert_not_nil(BufferFoo::Memcpy)
20
+ assert_not_nil(BufferFoo::Memccpy)
21
+ assert_not_nil(BufferFoo::Memchr)
22
+ assert_not_nil(BufferFoo::Memcmp)
23
+ assert_not_nil(BufferFoo::Memicmp)
24
+ assert_not_nil(BufferFoo::Memmove)
25
+ assert_not_nil(BufferFoo::Memset)
26
+ assert_not_nil(BufferFoo::Swab)
34
27
  end
35
28
 
36
29
  def test_memcpy
data/test/tc_path.rb CHANGED
@@ -3,91 +3,84 @@
3
3
  #
4
4
  # Test case for the Windows::Path module.
5
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
6
  require "windows/path"
14
7
  require "test/unit"
15
8
 
16
- class Foo
9
+ class PathFoo
17
10
  include Windows::Path
18
11
  end
19
12
 
20
13
  class TC_Windows_Path < Test::Unit::TestCase
21
14
  def setup
22
- @foo = Foo.new
15
+ @foo = PathFoo.new
23
16
  @path = "C:\\"
24
17
  end
25
18
 
26
19
  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)
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)
32
25
  end
33
26
 
34
27
  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)
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)
91
84
  end
92
85
 
93
86
  def teardown
data/test/tc_pipe.rb CHANGED
@@ -3,55 +3,48 @@
3
3
  #
4
4
  # Test case for the Windows::Pipe module.
5
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
6
  require 'windows/pipe'
14
7
  require 'test/unit'
15
8
 
16
- class Foo
9
+ class PipeFoo
17
10
  include Windows::Pipe
18
11
  end
19
12
 
20
13
  class TC_Windows_Pipe < Test::Unit::TestCase
21
14
 
22
15
  def setup
23
- @foo = Foo.new
16
+ @foo = PipeFoo.new
24
17
  end
25
18
 
26
19
  def test_numeric_constants
27
- assert_equal(0x00000001, Foo::NMPWAIT_NOWAIT)
28
- assert_equal(0xffffffff, Foo::NMPWAIT_WAIT_FOREVER)
29
- assert_equal(0x00000000, Foo::NMPWAIT_USE_DEFAULT_WAIT)
30
- assert_equal(0x00000000, Foo::PIPE_WAIT)
31
- assert_equal(0x00000001, Foo::PIPE_NOWAIT)
32
- assert_equal(0x00000001, Foo::PIPE_ACCESS_INBOUND)
33
- assert_equal(0x00000002, Foo::PIPE_ACCESS_OUTBOUND)
34
- assert_equal(0x00000003, Foo::PIPE_ACCESS_DUPLEX)
35
- assert_equal(0x00000000, Foo::PIPE_TYPE_BYTE)
36
- assert_equal(0x00000004, Foo::PIPE_TYPE_MESSAGE)
37
- assert_equal(0x00000000, Foo::PIPE_READMODE_BYTE)
38
- assert_equal(0x00000002, Foo::PIPE_READMODE_MESSAGE)
39
- assert_equal(0x00000000, Foo::PIPE_CLIENT_END)
40
- assert_equal(0x00000001, Foo::PIPE_SERVER_END)
20
+ assert_equal(0x00000001, PipeFoo::NMPWAIT_NOWAIT)
21
+ assert_equal(0xffffffff, PipeFoo::NMPWAIT_WAIT_FOREVER)
22
+ assert_equal(0x00000000, PipeFoo::NMPWAIT_USE_DEFAULT_WAIT)
23
+ assert_equal(0x00000000, PipeFoo::PIPE_WAIT)
24
+ assert_equal(0x00000001, PipeFoo::PIPE_NOWAIT)
25
+ assert_equal(0x00000001, PipeFoo::PIPE_ACCESS_INBOUND)
26
+ assert_equal(0x00000002, PipeFoo::PIPE_ACCESS_OUTBOUND)
27
+ assert_equal(0x00000003, PipeFoo::PIPE_ACCESS_DUPLEX)
28
+ assert_equal(0x00000000, PipeFoo::PIPE_TYPE_BYTE)
29
+ assert_equal(0x00000004, PipeFoo::PIPE_TYPE_MESSAGE)
30
+ assert_equal(0x00000000, PipeFoo::PIPE_READMODE_BYTE)
31
+ assert_equal(0x00000002, PipeFoo::PIPE_READMODE_MESSAGE)
32
+ assert_equal(0x00000000, PipeFoo::PIPE_CLIENT_END)
33
+ assert_equal(0x00000001, PipeFoo::PIPE_SERVER_END)
41
34
  end
42
35
 
43
36
  def test_method_constants
44
- assert_not_nil(Foo::CallNamedPipe)
45
- assert_not_nil(Foo::ConnectNamedPipe)
46
- assert_not_nil(Foo::CreateNamedPipe)
47
- assert_not_nil(Foo::CreatePipe)
48
- assert_not_nil(Foo::DisconnectNamedPipe)
49
- assert_not_nil(Foo::GetNamedPipeHandleState)
50
- assert_not_nil(Foo::GetNamedPipeInfo)
51
- assert_not_nil(Foo::PeekNamedPipe)
52
- assert_not_nil(Foo::SetNamedPipeHandleState)
53
- assert_not_nil(Foo::TransactNamedPipe)
54
- assert_not_nil(Foo::WaitNamedPipe)
37
+ assert_not_nil(PipeFoo::CallNamedPipe)
38
+ assert_not_nil(PipeFoo::ConnectNamedPipe)
39
+ assert_not_nil(PipeFoo::CreateNamedPipe)
40
+ assert_not_nil(PipeFoo::CreatePipe)
41
+ assert_not_nil(PipeFoo::DisconnectNamedPipe)
42
+ assert_not_nil(PipeFoo::GetNamedPipeHandleState)
43
+ assert_not_nil(PipeFoo::GetNamedPipeInfo)
44
+ assert_not_nil(PipeFoo::PeekNamedPipe)
45
+ assert_not_nil(PipeFoo::SetNamedPipeHandleState)
46
+ assert_not_nil(PipeFoo::TransactNamedPipe)
47
+ assert_not_nil(PipeFoo::WaitNamedPipe)
55
48
  end
56
49
 
57
50
  def teardown
data/test/tc_process.rb CHANGED
@@ -3,31 +3,24 @@
3
3
  #
4
4
  # Test case for the Windows::Process module.
5
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
6
  require 'windows/process'
14
7
  require 'test/unit'
15
8
 
16
- class Foo
9
+ class ProcessFoo
17
10
  include Windows::Process
18
11
  end
19
12
 
20
13
  class TC_Windows_Process < Test::Unit::TestCase
21
14
  def setup
22
- @foo = Foo.new
15
+ @foo = ProcessFoo.new
23
16
  end
24
17
 
25
18
  def test_numeric_constants
26
- assert_equal(0x1F0FFF, Foo::PROCESS_ALL_ACCESS)
19
+ assert_equal(0x1F0FFF, ProcessFoo::PROCESS_ALL_ACCESS)
27
20
  end
28
21
 
29
22
  def test_method_constants
30
- assert_not_nil(Foo::CreateProcess)
23
+ assert_not_nil(ProcessFoo::CreateProcess)
31
24
  end
32
25
 
33
26
  def teardown
data/test/tc_registry.rb CHANGED
@@ -3,31 +3,24 @@
3
3
  #
4
4
  # Test case for the Windows::Registry module.
5
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
6
  require 'windows/registry'
14
7
  require 'test/unit'
15
8
 
16
- class Foo
9
+ class RegistryFoo
17
10
  include Windows::Registry
18
11
  end
19
12
 
20
13
  class TC_Windows_Registry < Test::Unit::TestCase
21
14
  def setup
22
- @foo = Foo.new
15
+ @foo = RegistryFoo.new
23
16
  end
24
17
 
25
18
  def test_numeric_constants
26
- assert_equal(0x80000000, Foo::HKEY_CLASSES_ROOT)
19
+ assert_equal(0x80000000, RegistryFoo::HKEY_CLASSES_ROOT)
27
20
  end
28
21
 
29
22
  def test_method_constants
30
- assert_not_nil(Foo::RegCloseKey)
23
+ assert_not_nil(RegistryFoo::RegCloseKey)
31
24
  end
32
25
 
33
26
  def teardown
data/test/tc_security.rb CHANGED
@@ -3,54 +3,47 @@
3
3
  #
4
4
  # Test case for the Windows::Security module.
5
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
6
  require "windows/security"
14
7
  require "test/unit"
15
8
 
16
- class Foo
9
+ class SecurityFoo
17
10
  include Windows::Security
18
11
  end
19
12
 
20
- class TC_Windows_Path < Test::Unit::TestCase
13
+ class TC_Windows_Security < Test::Unit::TestCase
21
14
  def setup
22
- @foo = Foo.new
15
+ @foo = SecurityFoo.new
23
16
  end
24
17
 
25
18
  def test_numeric_constants
26
- assert_equal(2, Foo::ACL_REVISION)
27
- assert_equal(2, Foo::ACL_REVISION2)
28
- assert_equal(3, Foo::ACL_REVISION3)
29
- assert_equal(4, Foo::ACL_REVISION4)
30
- assert_equal(62, Foo::ALLOW_ACE_LENGTH)
31
- assert_equal(4, Foo::DACL_SECURITY_INFORMATION)
32
- assert_equal(4, Foo::SE_DACL_PRESENT)
33
- assert_equal(20, Foo::SECURITY_DESCRIPTOR_MIN_LENGTH)
34
- assert_equal(1, Foo::SECURITY_DESCRIPTOR_REVISION)
35
- assert_equal(4026597376, Foo::GENERIC_RIGHTS_MASK)
36
- assert_equal(4026531840, Foo::GENERIC_RIGHTS_CHK)
37
- assert_equal(2097151, Foo::REST_RIGHTS_MASK)
19
+ assert_equal(2, SecurityFoo::ACL_REVISION)
20
+ assert_equal(2, SecurityFoo::ACL_REVISION2)
21
+ assert_equal(3, SecurityFoo::ACL_REVISION3)
22
+ assert_equal(4, SecurityFoo::ACL_REVISION4)
23
+ assert_equal(62, SecurityFoo::ALLOW_ACE_LENGTH)
24
+ assert_equal(4, SecurityFoo::DACL_SECURITY_INFORMATION)
25
+ assert_equal(4, SecurityFoo::SE_DACL_PRESENT)
26
+ assert_equal(20, SecurityFoo::SECURITY_DESCRIPTOR_MIN_LENGTH)
27
+ assert_equal(1, SecurityFoo::SECURITY_DESCRIPTOR_REVISION)
28
+ assert_equal(4026597376, SecurityFoo::GENERIC_RIGHTS_MASK)
29
+ assert_equal(4026531840, SecurityFoo::GENERIC_RIGHTS_CHK)
30
+ assert_equal(2097151, SecurityFoo::REST_RIGHTS_MASK)
38
31
  end
39
32
 
40
33
  def test_method_constants
41
- assert_not_nil(Foo::AddAce)
42
- assert_not_nil(Foo::CopySid)
43
- assert_not_nil(Foo::GetAce)
44
- assert_not_nil(Foo::GetFileSecurity)
45
- assert_not_nil(Foo::GetLengthSid)
46
- assert_not_nil(Foo::GetSecurityDescriptorControl)
47
- assert_not_nil(Foo::GetSecurityDescriptorDacl)
48
- assert_not_nil(Foo::InitializeAcl)
49
- assert_not_nil(Foo::InitializeSecurityDescriptor)
50
- assert_not_nil(Foo::LookupAccountName)
51
- assert_not_nil(Foo::LookupAccountSid)
52
- assert_not_nil(Foo::SetFileSecurity)
53
- assert_not_nil(Foo::SetSecurityDescriptorDacl)
34
+ assert_not_nil(SecurityFoo::AddAce)
35
+ assert_not_nil(SecurityFoo::CopySid)
36
+ assert_not_nil(SecurityFoo::GetAce)
37
+ assert_not_nil(SecurityFoo::GetFileSecurity)
38
+ assert_not_nil(SecurityFoo::GetLengthSid)
39
+ assert_not_nil(SecurityFoo::GetSecurityDescriptorControl)
40
+ assert_not_nil(SecurityFoo::GetSecurityDescriptorDacl)
41
+ assert_not_nil(SecurityFoo::InitializeAcl)
42
+ assert_not_nil(SecurityFoo::InitializeSecurityDescriptor)
43
+ assert_not_nil(SecurityFoo::LookupAccountName)
44
+ assert_not_nil(SecurityFoo::LookupAccountSid)
45
+ assert_not_nil(SecurityFoo::SetFileSecurity)
46
+ assert_not_nil(SecurityFoo::SetSecurityDescriptorDacl)
54
47
  end
55
48
 
56
49
  def test_add_ace