sys-proctable 0.9.8-universal-mingw32 → 0.9.9-universal-mingw32
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -13
- checksums.yaml.gz.sig +0 -0
- data/CHANGES +353 -347
- data/MANIFEST +34 -33
- data/README +118 -118
- data/Rakefile +218 -198
- data/benchmarks/bench_ps.rb +21 -21
- data/doc/top.txt +46 -46
- data/examples/example_ps.rb +20 -20
- data/lib/sys/proctable/version.rb +6 -6
- data/lib/sys/top.rb +31 -31
- data/lib/sys-proctable.rb +1 -0
- data/lib/windows/sys/proctable.rb +207 -207
- data/sys-proctable.gemspec +40 -39
- data/test/test_sys_proctable_all.rb +87 -87
- data/test/test_sys_proctable_windows.rb +324 -324
- data/test/test_sys_top.rb +46 -46
- data.tar.gz.sig +0 -0
- metadata +40 -17
- metadata.gz.sig +0 -0
@@ -1,87 +1,87 @@
|
|
1
|
-
#######################################################################
|
2
|
-
# test_sys_proctable_all.rb
|
3
|
-
#
|
4
|
-
# Test suite for methods common to all platforms. Generally speaking
|
5
|
-
# you should run this test case using the 'rake test' task.
|
6
|
-
#######################################################################
|
7
|
-
require 'test-unit'
|
8
|
-
require 'sys/proctable'
|
9
|
-
require 'test/test_sys_top'
|
10
|
-
include Sys
|
11
|
-
|
12
|
-
class TC_ProcTable_All < Test::Unit::TestCase
|
13
|
-
def self.startup
|
14
|
-
@@windows = File::ALT_SEPARATOR
|
15
|
-
end
|
16
|
-
|
17
|
-
def setup
|
18
|
-
@pid = @@windows ? 0 : 1
|
19
|
-
end
|
20
|
-
|
21
|
-
def test_version
|
22
|
-
assert_equal('0.9.
|
23
|
-
end
|
24
|
-
|
25
|
-
def test_fields
|
26
|
-
assert_respond_to(ProcTable, :fields)
|
27
|
-
assert_nothing_raised{ ProcTable.fields }
|
28
|
-
assert_kind_of(Array, ProcTable.fields)
|
29
|
-
assert_kind_of(String, ProcTable.fields.first)
|
30
|
-
end
|
31
|
-
|
32
|
-
def test_ps
|
33
|
-
assert_respond_to(ProcTable, :ps)
|
34
|
-
assert_nothing_raised{ ProcTable.ps }
|
35
|
-
assert_nothing_raised{ ProcTable.ps{} }
|
36
|
-
end
|
37
|
-
|
38
|
-
def test_ps_with_pid
|
39
|
-
assert_nothing_raised{ ProcTable.ps(0) }
|
40
|
-
end
|
41
|
-
|
42
|
-
def test_ps_with_explicit_nil
|
43
|
-
assert_nothing_raised{ ProcTable.ps(nil) }
|
44
|
-
assert_kind_of(Array, ProcTable.ps(nil))
|
45
|
-
end
|
46
|
-
|
47
|
-
def test_ps_return_value
|
48
|
-
assert_kind_of(Array, ProcTable.ps)
|
49
|
-
assert_kind_of(Struct::ProcTableStruct, ProcTable.ps(@pid))
|
50
|
-
assert_equal(nil, ProcTable.ps(999999999))
|
51
|
-
assert_equal(nil, ProcTable.ps(999999999){})
|
52
|
-
assert_equal(nil, ProcTable.ps{})
|
53
|
-
end
|
54
|
-
|
55
|
-
def test_ps_returned_struct_is_frozen
|
56
|
-
assert_true(ProcTable.ps.first.frozen?)
|
57
|
-
end
|
58
|
-
|
59
|
-
def test_ps_expected_errors
|
60
|
-
assert_raises(TypeError){ ProcTable.ps('vim') }
|
61
|
-
omit_if(@@windows, 'ArgumentError check skipped on MS Windows')
|
62
|
-
assert_raises(ArgumentError){ ProcTable.ps(0, 'localhost') }
|
63
|
-
end
|
64
|
-
|
65
|
-
def test_new_not_allowed
|
66
|
-
assert_raise(NoMethodError){ Sys::ProcTable.new }
|
67
|
-
end
|
68
|
-
|
69
|
-
def test_error_class_defined
|
70
|
-
assert_not_nil(Sys::ProcTable::Error)
|
71
|
-
assert_kind_of(StandardError, Sys::ProcTable::Error.new)
|
72
|
-
end
|
73
|
-
|
74
|
-
def test_from_thread
|
75
|
-
Thread.new do
|
76
|
-
Sys::ProcTable.ps
|
77
|
-
end.value
|
78
|
-
end
|
79
|
-
|
80
|
-
def teardown
|
81
|
-
@pid = nil
|
82
|
-
end
|
83
|
-
|
84
|
-
def self.teardown
|
85
|
-
@@windows = nil
|
86
|
-
end
|
87
|
-
end
|
1
|
+
#######################################################################
|
2
|
+
# test_sys_proctable_all.rb
|
3
|
+
#
|
4
|
+
# Test suite for methods common to all platforms. Generally speaking
|
5
|
+
# you should run this test case using the 'rake test' task.
|
6
|
+
#######################################################################
|
7
|
+
require 'test-unit'
|
8
|
+
require 'sys/proctable'
|
9
|
+
require 'test/test_sys_top'
|
10
|
+
include Sys
|
11
|
+
|
12
|
+
class TC_ProcTable_All < Test::Unit::TestCase
|
13
|
+
def self.startup
|
14
|
+
@@windows = File::ALT_SEPARATOR
|
15
|
+
end
|
16
|
+
|
17
|
+
def setup
|
18
|
+
@pid = @@windows ? 0 : 1
|
19
|
+
end
|
20
|
+
|
21
|
+
def test_version
|
22
|
+
assert_equal('0.9.9', ProcTable::VERSION)
|
23
|
+
end
|
24
|
+
|
25
|
+
def test_fields
|
26
|
+
assert_respond_to(ProcTable, :fields)
|
27
|
+
assert_nothing_raised{ ProcTable.fields }
|
28
|
+
assert_kind_of(Array, ProcTable.fields)
|
29
|
+
assert_kind_of(String, ProcTable.fields.first)
|
30
|
+
end
|
31
|
+
|
32
|
+
def test_ps
|
33
|
+
assert_respond_to(ProcTable, :ps)
|
34
|
+
assert_nothing_raised{ ProcTable.ps }
|
35
|
+
assert_nothing_raised{ ProcTable.ps{} }
|
36
|
+
end
|
37
|
+
|
38
|
+
def test_ps_with_pid
|
39
|
+
assert_nothing_raised{ ProcTable.ps(0) }
|
40
|
+
end
|
41
|
+
|
42
|
+
def test_ps_with_explicit_nil
|
43
|
+
assert_nothing_raised{ ProcTable.ps(nil) }
|
44
|
+
assert_kind_of(Array, ProcTable.ps(nil))
|
45
|
+
end
|
46
|
+
|
47
|
+
def test_ps_return_value
|
48
|
+
assert_kind_of(Array, ProcTable.ps)
|
49
|
+
assert_kind_of(Struct::ProcTableStruct, ProcTable.ps(@pid))
|
50
|
+
assert_equal(nil, ProcTable.ps(999999999))
|
51
|
+
assert_equal(nil, ProcTable.ps(999999999){})
|
52
|
+
assert_equal(nil, ProcTable.ps{})
|
53
|
+
end
|
54
|
+
|
55
|
+
def test_ps_returned_struct_is_frozen
|
56
|
+
assert_true(ProcTable.ps.first.frozen?)
|
57
|
+
end
|
58
|
+
|
59
|
+
def test_ps_expected_errors
|
60
|
+
assert_raises(TypeError){ ProcTable.ps('vim') }
|
61
|
+
omit_if(@@windows, 'ArgumentError check skipped on MS Windows')
|
62
|
+
assert_raises(ArgumentError){ ProcTable.ps(0, 'localhost') }
|
63
|
+
end
|
64
|
+
|
65
|
+
def test_new_not_allowed
|
66
|
+
assert_raise(NoMethodError){ Sys::ProcTable.new }
|
67
|
+
end
|
68
|
+
|
69
|
+
def test_error_class_defined
|
70
|
+
assert_not_nil(Sys::ProcTable::Error)
|
71
|
+
assert_kind_of(StandardError, Sys::ProcTable::Error.new)
|
72
|
+
end
|
73
|
+
|
74
|
+
def test_from_thread
|
75
|
+
Thread.new do
|
76
|
+
Sys::ProcTable.ps
|
77
|
+
end.value
|
78
|
+
end
|
79
|
+
|
80
|
+
def teardown
|
81
|
+
@pid = nil
|
82
|
+
end
|
83
|
+
|
84
|
+
def self.teardown
|
85
|
+
@@windows = nil
|
86
|
+
end
|
87
|
+
end
|