rbbt-util 5.42.0 → 5.44.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (143) hide show
  1. checksums.yaml +4 -4
  2. data/lib/rbbt/annotations/util.rb +1 -1
  3. data/lib/rbbt/association/database.rb +2 -1
  4. data/lib/rbbt/association/index.rb +1 -0
  5. data/lib/rbbt/association/util.rb +14 -4
  6. data/lib/rbbt/entity.rb +6 -5
  7. data/lib/rbbt/hpc/batch.rb +19 -17
  8. data/lib/rbbt/hpc/orchestrate/batches.rb +1 -1
  9. data/lib/rbbt/hpc/orchestrate/chains.rb +3 -4
  10. data/lib/rbbt/knowledge_base/traverse.rb +24 -16
  11. data/lib/rbbt/persist/tsv/tokyocabinet.rb +1 -1
  12. data/lib/rbbt/resource/path.rb +7 -2
  13. data/lib/rbbt/resource.rb +1 -1
  14. data/lib/rbbt/tsv/accessor.rb +6 -11
  15. data/lib/rbbt/tsv/dumper.rb +21 -10
  16. data/lib/rbbt/tsv/index.rb +2 -1
  17. data/lib/rbbt/tsv/parallel/traverse.rb +44 -0
  18. data/lib/rbbt/tsv/parser.rb +7 -6
  19. data/lib/rbbt/tsv/serializers.rb +1 -1
  20. data/lib/rbbt/tsv/util.rb +12 -0
  21. data/lib/rbbt/util/log/progress.rb +1 -1
  22. data/lib/rbbt/util/misc/bgzf.rb +5 -4
  23. data/lib/rbbt/util/misc/development.rb +4 -4
  24. data/lib/rbbt/util/misc/math.rb +0 -1
  25. data/lib/rbbt/util/misc.rb +1 -1
  26. data/lib/rbbt/util/open.rb +1 -1
  27. data/lib/rbbt/workflow/remote_workflow/driver/rest.rb +8 -3
  28. data/lib/rbbt/workflow/remote_workflow/remote_step.rb +4 -0
  29. data/lib/rbbt/workflow/step/info.rb +1 -0
  30. data/lib/rbbt/workflow/step.rb +2 -1
  31. data/lib/rbbt/workflow/util/trace.rb +2 -2
  32. data/lib/rbbt/workflow.rb +2 -2
  33. data/python/rbbt/__init__.py +2 -2
  34. data/share/rbbt_commands/workflow/task +1 -1
  35. metadata +4 -220
  36. data/test/rbbt/annotations/test_util.rb +0 -43
  37. data/test/rbbt/association/test_database.rb +0 -89
  38. data/test/rbbt/association/test_index.rb +0 -127
  39. data/test/rbbt/association/test_item.rb +0 -15
  40. data/test/rbbt/association/test_open.rb +0 -63
  41. data/test/rbbt/association/test_util.rb +0 -108
  42. data/test/rbbt/entity/test_identifiers.rb +0 -74
  43. data/test/rbbt/hpc/orchestrate/test_batches.rb +0 -113
  44. data/test/rbbt/hpc/orchestrate/test_chains.rb +0 -139
  45. data/test/rbbt/hpc/orchestrate/test_rules.rb +0 -92
  46. data/test/rbbt/hpc/test_batch.rb +0 -68
  47. data/test/rbbt/hpc/test_orchestrate.rb +0 -144
  48. data/test/rbbt/hpc/test_pbs.rb +0 -43
  49. data/test/rbbt/hpc/test_slurm.rb +0 -32
  50. data/test/rbbt/knowledge_base/test_enrichment.rb +0 -48
  51. data/test/rbbt/knowledge_base/test_entity.rb +0 -42
  52. data/test/rbbt/knowledge_base/test_query.rb +0 -46
  53. data/test/rbbt/knowledge_base/test_registry.rb +0 -81
  54. data/test/rbbt/knowledge_base/test_syndicate.rb +0 -48
  55. data/test/rbbt/knowledge_base/test_traverse.rb +0 -85
  56. data/test/rbbt/persist/test_tsv.rb +0 -88
  57. data/test/rbbt/persist/tsv/test_cdb.rb +0 -18
  58. data/test/rbbt/persist/tsv/test_kyotocabinet.rb +0 -27
  59. data/test/rbbt/persist/tsv/test_leveldb.rb +0 -18
  60. data/test/rbbt/persist/tsv/test_lmdb.rb +0 -18
  61. data/test/rbbt/persist/tsv/test_sharder.rb +0 -164
  62. data/test/rbbt/persist/tsv/test_tokyocabinet.rb +0 -262
  63. data/test/rbbt/resource/test_path.rb +0 -49
  64. data/test/rbbt/test_annotations.rb +0 -167
  65. data/test/rbbt/test_association.rb +0 -103
  66. data/test/rbbt/test_entity.rb +0 -249
  67. data/test/rbbt/test_fix_width_table.rb +0 -135
  68. data/test/rbbt/test_hpc.rb +0 -16
  69. data/test/rbbt/test_knowledge_base.rb +0 -149
  70. data/test/rbbt/test_monitor.rb +0 -11
  71. data/test/rbbt/test_packed_index.rb +0 -68
  72. data/test/rbbt/test_persist.rb +0 -85
  73. data/test/rbbt/test_resource.rb +0 -110
  74. data/test/rbbt/test_tsv.rb +0 -669
  75. data/test/rbbt/test_workflow.rb +0 -604
  76. data/test/rbbt/tsv/parallel/test_through.rb +0 -40
  77. data/test/rbbt/tsv/parallel/test_traverse.rb +0 -456
  78. data/test/rbbt/tsv/test_accessor.rb +0 -315
  79. data/test/rbbt/tsv/test_attach.rb +0 -718
  80. data/test/rbbt/tsv/test_change_id.rb +0 -61
  81. data/test/rbbt/tsv/test_csv.rb +0 -49
  82. data/test/rbbt/tsv/test_excel.rb +0 -171
  83. data/test/rbbt/tsv/test_field_index.rb +0 -19
  84. data/test/rbbt/tsv/test_filter.rb +0 -187
  85. data/test/rbbt/tsv/test_index.rb +0 -302
  86. data/test/rbbt/tsv/test_manipulate.rb +0 -337
  87. data/test/rbbt/tsv/test_marshal.rb +0 -24
  88. data/test/rbbt/tsv/test_matrix.rb +0 -20
  89. data/test/rbbt/tsv/test_parallel.rb +0 -7
  90. data/test/rbbt/tsv/test_parser.rb +0 -101
  91. data/test/rbbt/tsv/test_stream.rb +0 -253
  92. data/test/rbbt/tsv/test_util.rb +0 -52
  93. data/test/rbbt/util/R/test_eval.rb +0 -43
  94. data/test/rbbt/util/R/test_model.rb +0 -130
  95. data/test/rbbt/util/R/test_plot.rb +0 -38
  96. data/test/rbbt/util/concurrency/processes/test_socket.rb +0 -70
  97. data/test/rbbt/util/concurrency/test_processes.rb +0 -192
  98. data/test/rbbt/util/concurrency/test_threads.rb +0 -40
  99. data/test/rbbt/util/log/test_progress.rb +0 -111
  100. data/test/rbbt/util/misc/test_bgzf.rb +0 -48
  101. data/test/rbbt/util/misc/test_communication.rb +0 -11
  102. data/test/rbbt/util/misc/test_development.rb +0 -26
  103. data/test/rbbt/util/misc/test_format.rb +0 -10
  104. data/test/rbbt/util/misc/test_indiferent_hash.rb +0 -14
  105. data/test/rbbt/util/misc/test_lock.rb +0 -77
  106. data/test/rbbt/util/misc/test_multipart_payload.rb +0 -202
  107. data/test/rbbt/util/misc/test_omics.rb +0 -116
  108. data/test/rbbt/util/misc/test_pipes.rb +0 -343
  109. data/test/rbbt/util/misc/test_serialize.rb +0 -24
  110. data/test/rbbt/util/python/test_util.rb +0 -25
  111. data/test/rbbt/util/simpleopt/test_get.rb +0 -12
  112. data/test/rbbt/util/simpleopt/test_parse.rb +0 -10
  113. data/test/rbbt/util/simpleopt/test_setup.rb +0 -76
  114. data/test/rbbt/util/test_R.rb +0 -37
  115. data/test/rbbt/util/test_chain_methods.rb +0 -22
  116. data/test/rbbt/util/test_cmd.rb +0 -87
  117. data/test/rbbt/util/test_colorize.rb +0 -22
  118. data/test/rbbt/util/test_concurrency.rb +0 -6
  119. data/test/rbbt/util/test_config.rb +0 -69
  120. data/test/rbbt/util/test_excel2tsv.rb +0 -10
  121. data/test/rbbt/util/test_filecache.rb +0 -36
  122. data/test/rbbt/util/test_log.rb +0 -52
  123. data/test/rbbt/util/test_migrate.rb +0 -36
  124. data/test/rbbt/util/test_misc.rb +0 -723
  125. data/test/rbbt/util/test_open.rb +0 -200
  126. data/test/rbbt/util/test_procpath.rb +0 -23
  127. data/test/rbbt/util/test_python.rb +0 -140
  128. data/test/rbbt/util/test_semaphore.rb +0 -36
  129. data/test/rbbt/util/test_simpleDSL.rb +0 -55
  130. data/test/rbbt/util/test_simpleopt.rb +0 -11
  131. data/test/rbbt/util/test_ssh.rb +0 -10
  132. data/test/rbbt/util/test_tmpfile.rb +0 -32
  133. data/test/rbbt/workflow/step/test_dependencies.rb +0 -299
  134. data/test/rbbt/workflow/step/test_save_load_inputs.rb +0 -136
  135. data/test/rbbt/workflow/test_doc.rb +0 -30
  136. data/test/rbbt/workflow/test_remote_workflow.rb +0 -98
  137. data/test/rbbt/workflow/test_schedule.rb +0 -0
  138. data/test/rbbt/workflow/test_step.rb +0 -231
  139. data/test/rbbt/workflow/test_task.rb +0 -85
  140. data/test/rbbt/workflow/util/test_archive.rb +0 -31
  141. data/test/rbbt/workflow/util/test_data.rb +0 -67
  142. data/test/rbbt/workflow/util/test_orchestrator.rb +0 -273
  143. data/test/test_helper.rb +0 -90
@@ -1,200 +0,0 @@
1
- require File.expand_path(File.dirname(__FILE__) + '/../../test_helper')
2
- require 'rbbt/util/open'
3
- require 'rbbt/util/tmpfile'
4
- require 'rbbt/persist'
5
- require 'test/unit'
6
-
7
-
8
- class TestOpen < Test::Unit::TestCase
9
-
10
- def test_wget
11
- assert(Misc.fixutf8(Open.wget('http://google.com', :quiet => true).read) =~ /html/)
12
- end
13
-
14
- def test_nice
15
- nice = 0.5
16
-
17
- t = Time.now
18
- Open.wget('http://google.com', :quiet => true, :nice => nice).read
19
- assert(Time.now - t + 0.5 >= nice)
20
-
21
- Open.wget('http://google.com', :quiet => true, :nice => nice, :nice_key => 1).read
22
- t = Time.now
23
- Open.wget('http://google.com', :quiet => true, :nice => nice, :nice_key => 1).read
24
- assert(Time.now - t + 0.5 >= nice)
25
- end
26
-
27
- def test_remote?
28
- assert(Open.remote?('http://google.com'))
29
- assert(! Open.remote?('~/.bashrc'))
30
- end
31
-
32
- def test_open
33
- assert(Open.read('http://google.com', :quiet => true, :nocache => :update) =~ /html/)
34
- end
35
-
36
- def test_read
37
- content =<<-EOF
38
- 1
39
- 2
40
- 3
41
- 4
42
- EOF
43
- TmpFile.with_file(content) do |file|
44
- sum = 0
45
- Open.read file do |line| sum += line.to_i end
46
- assert_equal(1 + 2 + 3 + 4, sum)
47
- assert_equal(content, Open.read(file))
48
- end
49
- end
50
-
51
- def test_read_grep
52
- content =<<-EOF
53
- 1
54
- 2
55
- 3
56
- 4
57
- EOF
58
- TmpFile.with_file(content) do |file|
59
- sum = 0
60
- Open.read(file, :grep => '^1\|3') do |line| sum += line.to_i end
61
- assert_equal(1 + 3, sum)
62
- end
63
-
64
- TmpFile.with_file(content) do |file|
65
- sum = 0
66
- Open.read(file, :grep => ["1","3"]) do |line| sum += line.to_i end
67
- assert_equal(1 + 3, sum)
68
- end
69
- end
70
-
71
- def test_read_grep_invert
72
- content =<<-EOF
73
- 1
74
- 2
75
- 3
76
- 4
77
- EOF
78
- TmpFile.with_file(content) do |file|
79
- sum = 0
80
- Open.read(file, :grep => '^1\|3', :invert_grep => true) do |line| sum += line.to_i end
81
- assert_equal(2 + 4, sum)
82
- end
83
-
84
- TmpFile.with_file(content) do |file|
85
- sum = 0
86
- Open.read(file, :grep => ["1","3"]) do |line| sum += line.to_i end
87
- assert_equal(1 + 3, sum)
88
- end
89
-
90
- end
91
-
92
-
93
- def test_gzip
94
- content =<<-EOF
95
- 1
96
- 2
97
- 3
98
- 4
99
- EOF
100
- TmpFile.with_file(content) do |file|
101
- `gzip #{file}`
102
- assert_equal(content, Open.read(file + '.gz'))
103
- puts content
104
- FileUtils.rm file + '.gz'
105
- end
106
- end
107
-
108
- def test_repo_dir
109
- file1 = "TEST"
110
- file2 = "TEST" * 1000
111
- TmpFile.with_file do |tmpdir|
112
- tmpdir = Rbbt.tmp.repo_dir.find
113
- normal = File.join(tmpdir, 'normal')
114
- repo = File.join(tmpdir, 'repo')
115
-
116
- Open.repository_dirs.push(repo)
117
-
118
- Misc.benchmark(100) do
119
- filename = "file" << (rand * 100).to_i.to_s
120
- Open.write(File.join(normal, filename), file2)
121
- 100.times do
122
- Open.read(File.join(normal, filename))
123
- end
124
- end
125
-
126
- Misc.benchmark(100) do
127
- filename = "file" << (rand * 100).to_i.to_s
128
- Open.write(File.join(repo, filename), file2)
129
- 100.times do
130
- Open.read(File.join(repo, filename))
131
- end
132
- end
133
- end
134
- end
135
-
136
- def test_repo_dir2
137
- TmpFile.with_file do |tmpdir|
138
- tmpdir = Rbbt.tmp.repo_dir.find
139
- repo = File.join(tmpdir, 'repo')
140
-
141
- Open.repository_dirs.push(repo)
142
-
143
- obj = { :a => "???a"}
144
- filename = "file" << (rand * 100).to_i.to_s
145
- Open.write(File.join(repo, filename), Marshal.dump(obj))
146
- dump = Open.read(File.join(repo, filename))
147
- obj_cp = Marshal.load(dump)
148
- assert_equal obj, obj_cp
149
- end
150
- end
151
-
152
- def test_repo_marshal
153
- TmpFile.with_file do |tmpdir|
154
- tmpdir = Rbbt.tmp.repo_dir.find
155
- repo = File.join(tmpdir, 'repo')
156
-
157
- filename = 'file'
158
- Open.repository_dirs.push(repo)
159
-
160
- obj = {:a => "string", :pid => nil, :num => 1000, :p => Rbbt.tmp.foo}
161
- Open.write(File.join(repo, filename), Marshal.dump(obj))
162
- new =Open.open(File.join(repo, filename)) do |f|
163
- Marshal.load(f)
164
- end
165
-
166
- assert_equal new, obj
167
- end
168
-
169
- end
170
-
171
- def test_write_stream_repo
172
- TmpFile.with_file do |tmpdir|
173
- tmpdir = Rbbt.tmp.repo_dir.find
174
- repo = File.join(tmpdir, 'repo')
175
-
176
- file = File.join(repo, 'file')
177
- Open.repository_dirs.push(repo)
178
-
179
- text = (["text"] * 5) * "\n"
180
-
181
- Misc.consume_stream(StringIO.new(text), false, file)
182
-
183
- assert_equal text, Open.read(file)
184
- assert Open.exists?(file)
185
- refute File.exist?(file)
186
- end
187
-
188
- end
189
-
190
- def test_download_fails
191
- TmpFile.with_file do |tmp|
192
- assert_raise do
193
- Open.download("http:fake-host/some_path", tmp)
194
- end
195
- refute Open.exists?(tmp)
196
- end
197
- end
198
-
199
- end
200
-
@@ -1,23 +0,0 @@
1
- require File.join(File.expand_path(File.dirname(__FILE__)), '../..', 'test_helper.rb')
2
- require 'rbbt/util/procpath'
3
-
4
- class TestProcPath < Test::Unit::TestCase
5
- def test_record_and_plot
6
- Log.with_severity 0 do
7
- pid = Process.fork do
8
- a = ""
9
- (0..1000).each do
10
- a << (0..rand(10000).to_i).to_a.collect{|i| "TEST #{i}" } * " "
11
- sleep 0.1
12
- end
13
- end
14
-
15
- TmpFile.with_file(nil, false) do |db|
16
-
17
- ProcPath.record(pid, db, :interval => '1', "recnum" => 100)
18
- ProcPath.plot(db, db + '.svg', "moving-average-window" => 1 )
19
- end
20
- end
21
- end
22
- end
23
-
@@ -1,140 +0,0 @@
1
- require File.join(File.expand_path(File.dirname(__FILE__)), '../..', 'test_helper.rb')
2
- require 'rbbt/util/python'
3
-
4
- class TestPython < Test::Unit::TestCase
5
-
6
- def test_python
7
- TmpFile.with_file do |tmpdir|
8
- code =<<-EOF
9
- def python_test(a, b):
10
- c = a + b
11
- return c
12
- EOF
13
- Open.write(File.join(tmpdir, 'file1.py'), code)
14
- Open.write(File.join(tmpdir, 'file2.py'), code)
15
- Open.write(File.join(tmpdir, 'file3.py'), code)
16
- Open.write(File.join(tmpdir, 'file4.py'), code)
17
- RbbtPython.add_path tmpdir
18
-
19
- res = nil
20
-
21
- RbbtPython.run 'file2', :python_test do
22
- res = python_test(1, 3)
23
- end
24
- assert_equal 4, res
25
-
26
- RbbtPython.run do
27
- pyfrom :file3, :import => :python_test
28
- res = python_test(1, 4)
29
- end
30
- assert_equal 5, res
31
-
32
- RbbtPython.run do
33
- pyimport :file4
34
- res = file4.python_test(1, 4)
35
- end
36
- assert_equal 5, res
37
-
38
- RbbtPython.run 'file1' do
39
- res = file1.python_test(1, 2)
40
- end
41
- assert_equal 3, res
42
- end
43
- end
44
-
45
- def test_run_log
46
- TmpFile.with_file do |tmpdir|
47
- code =<<-EOF
48
- import sys
49
- def python_print():
50
- print("Test STDERR", file=sys.stderr)
51
- print("Test STDOUT")
52
- EOF
53
- Open.write(File.join(tmpdir, 'file_print.py'), code)
54
- RbbtPython.add_path tmpdir
55
-
56
- RbbtPython.run_log 'file_print' do
57
- file_print.python_print
58
- end
59
- RbbtPython.run_log_stderr 'file_print' do
60
- file_print.python_print
61
- end
62
-
63
- RbbtPython.run_log 'file_print' do
64
- file_print.python_print
65
- end
66
- end
67
- end
68
-
69
- def test_keras
70
- defined = RbbtPython.run do
71
- pyimport "tensorflow.keras.models", as: :km
72
- defined?(km.Sequential)
73
- end
74
- assert defined
75
- end
76
-
77
- def test_keras_import
78
- defined = RbbtPython.run do
79
- pyfrom "tensorflow.keras.models", import: :Sequential
80
- defined?(self::Sequential)
81
- end
82
- assert defined
83
- end
84
-
85
- def test_iterate
86
- a2, b2 = nil, nil
87
- RbbtPython.run :numpy, as: :np do
88
- a = np.array([1,2])
89
- a2 = RbbtPython.collect a do |e|
90
- e * 2
91
- end
92
- b = PyCall.tuple([1,2])
93
- b2 = RbbtPython.collect b do |e|
94
- e * 2
95
- end
96
- end
97
- assert_equal [2,4], a2
98
- assert_equal [2,4], b2
99
- end
100
-
101
- def test_lambda
102
- l = PyCall.eval "lambda e: e + 2"
103
- assert_equal 5, l.(3)
104
- end
105
-
106
- def test_binding
107
- raised = false
108
- RbbtPython.binding_run do
109
- pyimport :torch
110
- pyfrom :torch, import: ["nn"]
111
- begin
112
- torch
113
- rescue
114
- raised = true
115
- end
116
- end
117
- assert ! raised
118
-
119
- raised = false
120
- RbbtPython.binding_run do
121
- begin
122
- torch
123
- rescue
124
- raised = true
125
- end
126
- end
127
- assert raised
128
- end
129
-
130
- def test_import_method
131
- random = RbbtPython.import_method :torch, :rand, :random
132
- assert random.call(1).numpy.to_f > 0
133
- end
134
-
135
- def test_class_new_obj
136
- obj = RbbtPython.class_new_obj("torch.nn", "Module")
137
- assert_equal "Module()", obj.to_s
138
- end
139
- end
140
-
@@ -1,36 +0,0 @@
1
- require File.join(File.expand_path(File.dirname(__FILE__)), '../..', 'test_helper.rb')
2
- require 'rbbt/util/semaphore'
3
-
4
- class TestRbbtSemaphore < Test::Unit::TestCase
5
- def test_process
6
- RbbtSemaphore.with_semaphore(10) do |s|
7
- pids = []
8
- 100.times do
9
- pids << Process.fork do
10
- 100.times do
11
- RbbtSemaphore.wait_semaphore(s)
12
- sleep 0.001
13
- RbbtSemaphore.post_semaphore(s)
14
- end
15
- end
16
- end
17
- pids.each do |pid|
18
- Process.waitpid pid
19
- end
20
- end
21
- end
22
-
23
- def _test_thread
24
- times = 50
25
- TmpFile.with_file do |dir|
26
- Path.setup(dir)
27
- FileUtils.mkdir_p dir
28
- RbbtSemaphore.thread_each_on_semaphore((1..times).to_a, 25){|elem|
29
- sleep rand
30
- Open.write(dir[elem], "test")
31
- }
32
- assert_equal times, dir.glob.length
33
- end
34
- end
35
- end
36
-
@@ -1,55 +0,0 @@
1
- require File.expand_path(File.dirname(__FILE__) + '/../../test_helper')
2
- require 'rbbt/util/simpleDSL'
3
- require 'test/unit'
4
-
5
- class TestSimpleDSLClass
6
- include SimpleDSL
7
-
8
- def action(name, *args, &block)
9
- @actions ||= {}
10
- @actions[name] = args.first
11
- end
12
-
13
- def actions
14
- @actions
15
- end
16
- end
17
-
18
-
19
- class TestDSL < Test::Unit::TestCase
20
- def setup
21
- @parser = TestSimpleDSLClass.new
22
- @parser.load_config(:action) do
23
- action1 "Hello"
24
- action2 "Good bye"
25
- end
26
- end
27
-
28
- def test_actions
29
- assert_equal({:action1=>"Hello", :action2=>"Good bye"}, @parser.actions)
30
- end
31
-
32
- def test_method_missing
33
- assert_raise(NoMethodError){@parser.cues}
34
- end
35
-
36
- def test_config
37
- config = <<-EOC
38
- action1 "Hello"
39
- action2 "Good bye"
40
- EOC
41
-
42
- begin
43
- assert_equal config.split("\n").collect{|l| l.strip}, @parser.config(:action).split("\n").collect{|l| l.strip}
44
- rescue SimpleDSL::NoRuby2Ruby
45
- end
46
- end
47
-
48
- def test_parse
49
- @parser.parse :action do
50
- action3 "Back again"
51
- end
52
-
53
- assert_equal({:action1 =>"Hello", :action2 =>"Good bye", :action3 =>"Back again"}, @parser.actions)
54
- end
55
- end
@@ -1,11 +0,0 @@
1
- require File.expand_path(File.dirname(__FILE__) + '/../../test_helper')
2
- require 'rbbt/util/simpleopt'
3
- require 'test/unit'
4
-
5
- class TestSOPT < Test::Unit::TestCase
6
-
7
- def test_cmd_option_string
8
- SOPT.parse("-h--help:-to--tsv-options")
9
- assert_equal "tsv-options", SOPT.shortcuts["to"]
10
- end
11
- end
@@ -1,10 +0,0 @@
1
- require File.expand_path(__FILE__).sub(%r(/test/.*), '/test/test_helper.rb')
2
- require File.expand_path(__FILE__).sub(%r(.*/test/), '').sub(/test_(.*)\.rb/,'\1')
3
-
4
- class TestSSH < Test::Unit::TestCase
5
- def test_marshal
6
-
7
- assert TrueClass === SSHLine.rbbt('turbo', 'true')
8
- end
9
- end
10
-
@@ -1,32 +0,0 @@
1
- require File.expand_path(File.dirname(__FILE__) + '/../../test_helper')
2
- require 'rbbt/util/tmpfile'
3
- require 'test/unit'
4
-
5
- class TestTmpFile < Test::Unit::TestCase
6
-
7
- def test_tmp_file
8
- assert(TmpFile.tmp_file("test") =~ /(tmpfiles|tmp)\/test\d+$/)
9
- end
10
-
11
- def test_do_tmp_file
12
- content = "Hello World!"
13
- TmpFile.with_file(content) do |file|
14
- assert_equal content, File.open(file).read
15
- end
16
- end
17
-
18
- def test_extension
19
- TmpFile.with_file(nil, true, :extension => 'txt') do |file|
20
- assert file =~ /\.txt$/
21
- end
22
- end
23
-
24
- def test_tmpdir
25
- TmpFile.with_file(nil, true, :tmpdir => 'TMPDIR') do |file|
26
- assert file =~ /TMPDIR/
27
- end
28
- end
29
-
30
- end
31
-
32
-