ptools 1.3.7-universal-mingw32 → 1.4.0-universal-mingw32
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +0 -0
- data.tar.gz.sig +0 -0
- data/CHANGES +5 -2
- data/Gemfile +1 -1
- data/MANIFEST +19 -14
- data/README +1 -1
- data/Rakefile +30 -78
- data/lib/ptools.rb +1 -31
- data/ptools.gemspec +3 -3
- data/spec/binary_spec.rb +59 -0
- data/spec/constants_spec.rb +33 -0
- data/spec/head_spec.rb +41 -0
- data/spec/image_spec.rb +51 -0
- data/{test → spec}/img/test.gif +0 -0
- data/{test → spec}/img/test.ico +0 -0
- data/{test → spec}/img/test.jpg +0 -0
- data/{test → spec}/img/test.png +0 -0
- data/spec/nlconvert_spec.rb +104 -0
- data/spec/sparse_spec.rb +43 -0
- data/spec/tail_spec.rb +107 -0
- data/spec/touch_spec.rb +47 -0
- data/{test → spec}/txt/empty.txt +0 -0
- data/{test → spec}/txt/english.txt +0 -0
- data/{test → spec}/txt/english.utf16 +0 -0
- data/{test → spec}/txt/korean.txt +0 -0
- data/spec/wc_spec.rb +65 -0
- data/spec/whereis_spec.rb +87 -0
- data/spec/which_spec.rb +112 -0
- metadata +31 -49
- metadata.gz.sig +0 -0
- data/test/test_binary.rb +0 -74
- data/test/test_constants.rb +0 -39
- data/test/test_head.rb +0 -48
- data/test/test_image.rb +0 -62
- data/test/test_is_sparse.rb +0 -53
- data/test/test_nlconvert.rb +0 -110
- data/test/test_null.rb +0 -40
- data/test/test_tail.rb +0 -124
- data/test/test_touch.rb +0 -53
- data/test/test_wc.rb +0 -73
- data/test/test_whereis.rb +0 -98
- data/test/test_which.rb +0 -126
data/test/test_is_sparse.rb
DELETED
@@ -1,53 +0,0 @@
|
|
1
|
-
#####################################################################
|
2
|
-
# test_is_sparse.rb
|
3
|
-
#
|
4
|
-
# Test case for the File.sparse? method. You should run this test
|
5
|
-
# via the 'rake test:is_sparse' task.
|
6
|
-
#####################################################################
|
7
|
-
require 'test-unit'
|
8
|
-
require 'ptools'
|
9
|
-
|
10
|
-
class TC_IsSparse < Test::Unit::TestCase
|
11
|
-
def self.startup
|
12
|
-
Dir.chdir("test") if File.exist?("test")
|
13
|
-
@@win = File::ALT_SEPARATOR
|
14
|
-
@@osx = RbConfig::CONFIG['host_os'] =~ /darwin|osx/i
|
15
|
-
system("dd of=test_sparse bs=1k seek=5120 count=0 2>/dev/null") unless @@win
|
16
|
-
end
|
17
|
-
|
18
|
-
def setup
|
19
|
-
@sparse_file = 'test_sparse'
|
20
|
-
@non_sparse_file = File.expand_path(File.basename(__FILE__))
|
21
|
-
end
|
22
|
-
|
23
|
-
test "is_sparse basic functionality" do
|
24
|
-
omit_if(@@win, "File.sparse? tests skipped on MS Windows")
|
25
|
-
omit_if(@@osx, "File.sparse? tests skipped on OS X")
|
26
|
-
|
27
|
-
assert_respond_to(File, :sparse?)
|
28
|
-
assert_nothing_raised{ File.sparse?(@sparse_file) }
|
29
|
-
assert_boolean(File.sparse?(@sparse_file))
|
30
|
-
end
|
31
|
-
|
32
|
-
test "is_sparse returns the expected results" do
|
33
|
-
omit_if(@@win, "File.sparse? tests skipped on MS Windows")
|
34
|
-
omit_if(@@osx, "File.sparse? tests skipped on OS X")
|
35
|
-
|
36
|
-
assert_true(File.sparse?(@sparse_file))
|
37
|
-
assert_false(File.sparse?(@non_sparse_file))
|
38
|
-
end
|
39
|
-
|
40
|
-
test "is_sparse only accepts one argument" do
|
41
|
-
omit_if(@@win, "File.sparse? tests skipped on MS Windows")
|
42
|
-
assert_raise(ArgumentError){ File.sparse?(@sparse_file, @sparse_file) }
|
43
|
-
end
|
44
|
-
|
45
|
-
def teardown
|
46
|
-
@sparse_file = nil
|
47
|
-
@non_sparse_file = nil
|
48
|
-
end
|
49
|
-
|
50
|
-
def self.shutdown
|
51
|
-
File.delete('test_sparse') if File.exist?('test_sparse')
|
52
|
-
end
|
53
|
-
end
|
data/test/test_nlconvert.rb
DELETED
@@ -1,110 +0,0 @@
|
|
1
|
-
#####################################################################
|
2
|
-
# test_nlconvert.rb
|
3
|
-
#
|
4
|
-
# Test case for the File.nl_convert method. You should run this
|
5
|
-
# test via the 'rake test_nlconvert' task.
|
6
|
-
#####################################################################
|
7
|
-
require 'rubygems'
|
8
|
-
require 'test-unit'
|
9
|
-
require 'ptools'
|
10
|
-
|
11
|
-
class TC_Ptools_NLConvert < Test::Unit::TestCase
|
12
|
-
def self.startup
|
13
|
-
@@dirname = File.dirname(__FILE__)
|
14
|
-
@@test_file1 = File.join(@@dirname, 'test_nl_convert1.txt')
|
15
|
-
@@test_file2 = File.join(@@dirname, 'test_nl_convert2.txt')
|
16
|
-
File.open(@@test_file1, 'w'){ |fh| 10.times{ |n| fh.puts "line #{n}" } }
|
17
|
-
File.open(@@test_file2, 'w'){ |fh| 10.times{ |n| fh.puts "line #{n}" } }
|
18
|
-
end
|
19
|
-
|
20
|
-
def setup
|
21
|
-
@test_file1 = File.join(@@dirname, 'test_nl_convert1.txt')
|
22
|
-
@test_file2 = File.join(@@dirname, 'test_nl_convert2.txt')
|
23
|
-
@dos_file = File.join(@@dirname, 'dos_test_file.txt')
|
24
|
-
@mac_file = File.join(@@dirname, 'mac_test_file.txt')
|
25
|
-
@unix_file = 'nix_test_file.txt'
|
26
|
-
end
|
27
|
-
|
28
|
-
test "nl_for_platform basic functionality" do
|
29
|
-
assert_respond_to(File, :nl_for_platform)
|
30
|
-
end
|
31
|
-
|
32
|
-
test "nl_for_platform" do
|
33
|
-
assert_equal( "\cM\cJ", File.nl_for_platform('dos') )
|
34
|
-
assert_equal( "\cJ", File.nl_for_platform('unix') )
|
35
|
-
assert_equal( "\cM", File.nl_for_platform('mac') )
|
36
|
-
assert_nothing_raised{ File.nl_for_platform('local') }
|
37
|
-
end
|
38
|
-
|
39
|
-
test "nl_convert basic functionality" do
|
40
|
-
assert_respond_to(File, :nl_convert)
|
41
|
-
end
|
42
|
-
|
43
|
-
test "nl_convert accepts one, two or three arguments" do
|
44
|
-
assert_nothing_raised{ File.nl_convert(@test_file2) }
|
45
|
-
assert_nothing_raised{ File.nl_convert(@test_file2, @test_file2) }
|
46
|
-
assert_nothing_raised{ File.nl_convert(@test_file2, @test_file2, "unix") }
|
47
|
-
end
|
48
|
-
|
49
|
-
test "nl_convert with dos platform argument works as expected" do
|
50
|
-
msg = "dos file should be larger, but isn't"
|
51
|
-
|
52
|
-
assert_nothing_raised{ File.nl_convert(@test_file1, @dos_file, "dos") }
|
53
|
-
assert_true(File.size(@dos_file) > File.size(@test_file1), msg)
|
54
|
-
assert_equal(["\cM","\cJ"], IO.readlines(@dos_file).first.split("")[-2..-1])
|
55
|
-
end
|
56
|
-
|
57
|
-
test "nl_convert with mac platform argument works as expected" do
|
58
|
-
assert_nothing_raised{ File.nl_convert(@test_file1, @mac_file, 'mac') }
|
59
|
-
assert_equal("\cM", IO.readlines(@mac_file).first.split("").last)
|
60
|
-
|
61
|
-
omit_if(File::ALT_SEPARATOR)
|
62
|
-
msg = "=> Mac file should be the same size (or larger), but isn't"
|
63
|
-
assert_true(File.size(@mac_file) == File.size(@test_file1), msg)
|
64
|
-
end
|
65
|
-
|
66
|
-
test "nl_convert with unix platform argument works as expected" do
|
67
|
-
msg = "unix file should be the same size (or smaller), but isn't"
|
68
|
-
|
69
|
-
assert_nothing_raised{ File.nl_convert(@test_file1, @unix_file, "unix") }
|
70
|
-
assert_equal("\n", IO.readlines(@unix_file).first.split("").last)
|
71
|
-
|
72
|
-
if File::ALT_SEPARATOR
|
73
|
-
assert_true(File.size(@unix_file) >= File.size(@test_file1), msg)
|
74
|
-
else
|
75
|
-
assert_true(File.size(@unix_file) <= File.size(@test_file1), msg)
|
76
|
-
end
|
77
|
-
end
|
78
|
-
|
79
|
-
test "nl_convert requires at least one argument" do
|
80
|
-
assert_raise(ArgumentError){ File.nl_convert }
|
81
|
-
end
|
82
|
-
|
83
|
-
test "nl_convert requires a valid platform string" do
|
84
|
-
assert_raise(ArgumentError){ File.nl_convert(@test_file1, "bogus.txt", "blah") }
|
85
|
-
end
|
86
|
-
|
87
|
-
test "nl_convert accepts a maximum of three arguments" do
|
88
|
-
assert_raise(ArgumentError){ File.nl_convert(@test_file1, @test_file2, 'dos', 1) }
|
89
|
-
end
|
90
|
-
|
91
|
-
test "nl_convert will fail on anything but plain files" do
|
92
|
-
assert_raise(ArgumentError){ File.nl_convert(File.null_device, @test_file1) }
|
93
|
-
end
|
94
|
-
|
95
|
-
def teardown
|
96
|
-
[@dos_file, @mac_file, @unix_file].each{ |file|
|
97
|
-
File.delete(file) if File.exist?(file)
|
98
|
-
}
|
99
|
-
@dos_file = nil
|
100
|
-
@mac_file = nil
|
101
|
-
@unix_file = nil
|
102
|
-
@test_file1 = nil
|
103
|
-
@test_file2 = nil
|
104
|
-
end
|
105
|
-
|
106
|
-
def self.shutdown
|
107
|
-
File.delete(@@test_file1) if File.exist?(@@test_file1)
|
108
|
-
File.delete(@@test_file2) if File.exist?(@@test_file2)
|
109
|
-
end
|
110
|
-
end
|
data/test/test_null.rb
DELETED
@@ -1,40 +0,0 @@
|
|
1
|
-
#####################################################################
|
2
|
-
# test_null.rb
|
3
|
-
#
|
4
|
-
# Test case for the File.null method. You should run this test via
|
5
|
-
# the 'rake test_null' task.
|
6
|
-
#####################################################################
|
7
|
-
require 'rubygems'
|
8
|
-
gem 'test-unit'
|
9
|
-
|
10
|
-
require 'test/unit'
|
11
|
-
require 'ptools'
|
12
|
-
|
13
|
-
class TC_FileNull < Test::Unit::TestCase
|
14
|
-
def setup
|
15
|
-
@nulls = ['/dev/null', 'NUL', 'NIL:', 'NL:']
|
16
|
-
end
|
17
|
-
|
18
|
-
test "null method basic functionality" do
|
19
|
-
assert_respond_to(File, :null)
|
20
|
-
assert_nothing_raised{ File.null }
|
21
|
-
end
|
22
|
-
|
23
|
-
test "null method returns expected results" do
|
24
|
-
assert_kind_of(String, File.null)
|
25
|
-
assert(@nulls.include?(File.null))
|
26
|
-
end
|
27
|
-
|
28
|
-
test "null method does not accept any arguments" do
|
29
|
-
assert_raises(ArgumentError){ File.null(1) }
|
30
|
-
end
|
31
|
-
|
32
|
-
test "null_device is an alias for null" do
|
33
|
-
assert_respond_to(File, :null_device)
|
34
|
-
assert_alias_method(File, :null_device, :null)
|
35
|
-
end
|
36
|
-
|
37
|
-
def teardown
|
38
|
-
@nulls = nil
|
39
|
-
end
|
40
|
-
end
|
data/test/test_tail.rb
DELETED
@@ -1,124 +0,0 @@
|
|
1
|
-
#####################################################################
|
2
|
-
# test_tail.rb
|
3
|
-
#
|
4
|
-
# Test case for the File.tail method. This test should be run via
|
5
|
-
# the 'rake test_tail' task.
|
6
|
-
#####################################################################
|
7
|
-
require 'test-unit'
|
8
|
-
require 'ptools'
|
9
|
-
|
10
|
-
class TC_FileTail < Test::Unit::TestCase
|
11
|
-
def self.startup
|
12
|
-
@@dirname = File.dirname(__FILE__)
|
13
|
-
|
14
|
-
@@test_file1 = File.join(@@dirname, 'test_file1.txt')
|
15
|
-
@@test_file64 = File.join(@@dirname, 'test_file64.txt')
|
16
|
-
@@test_file128 = File.join(@@dirname, 'test_file128.txt')
|
17
|
-
|
18
|
-
@@test_file_trail = File.join(@@dirname, 'test_file_trail.txt')
|
19
|
-
@@test_file_trail_nl = File.join(@@dirname, 'test_file_trail_nl.txt')
|
20
|
-
|
21
|
-
File.open(@@test_file1, 'w'){ |fh|
|
22
|
-
25.times{ |n| fh.puts "line#{n+1}" }
|
23
|
-
}
|
24
|
-
|
25
|
-
# Trailing newline test
|
26
|
-
File.open(@@test_file_trail, 'w'){ |fh|
|
27
|
-
2.times{ |n| fh.puts "trail#{n+1}" }
|
28
|
-
fh.write "trail3"
|
29
|
-
}
|
30
|
-
File.open(@@test_file_trail_nl, 'w'){ |fh|
|
31
|
-
3.times{ |n| fh.puts "trail#{n+1}" }
|
32
|
-
}
|
33
|
-
|
34
|
-
# Larger files
|
35
|
-
test_tail_fmt_str = "line data data data data data data data %5s"
|
36
|
-
|
37
|
-
File.open(@@test_file64, 'w'){ |fh|
|
38
|
-
2000.times{ |n|
|
39
|
-
fh.puts test_tail_fmt_str % (n+1).to_s
|
40
|
-
}
|
41
|
-
}
|
42
|
-
|
43
|
-
File.open(@@test_file128, 'w'){ |fh|
|
44
|
-
4500.times{ |n|
|
45
|
-
fh.puts test_tail_fmt_str % (n+1).to_s
|
46
|
-
}
|
47
|
-
}
|
48
|
-
end
|
49
|
-
|
50
|
-
def setup
|
51
|
-
@test_file = @@test_file1
|
52
|
-
@test_trail = @@test_file_trail
|
53
|
-
@test_trail_nl = @@test_file_trail_nl
|
54
|
-
@test_file_64 = @@test_file64
|
55
|
-
@test_file_128 = @@test_file128
|
56
|
-
|
57
|
-
@expected_tail1 = %w{
|
58
|
-
line16 line17 line18 line19 line20
|
59
|
-
line21 line22 line23 line24 line25
|
60
|
-
}
|
61
|
-
|
62
|
-
@expected_tail2 = ["line21","line22","line23","line24","line25"]
|
63
|
-
|
64
|
-
@expected_tail_more = []
|
65
|
-
25.times{ |n| @expected_tail_more.push "line#{n+1}" }
|
66
|
-
|
67
|
-
@expected_tail_trail = %w{ trail2 trail3 }
|
68
|
-
|
69
|
-
@test_tail_fmt_str = "line data data data data data data data %5s"
|
70
|
-
end
|
71
|
-
|
72
|
-
def test_tail_basic
|
73
|
-
assert_respond_to(File, :tail)
|
74
|
-
assert_nothing_raised{ File.tail(@test_file) }
|
75
|
-
assert_nothing_raised{ File.tail(@test_file, 5) }
|
76
|
-
assert_nothing_raised{ File.tail(@test_file){} }
|
77
|
-
end
|
78
|
-
|
79
|
-
def test_tail_expected_return_values
|
80
|
-
assert_kind_of(Array, File.tail(@test_file))
|
81
|
-
assert_equal(@expected_tail1, File.tail(@test_file))
|
82
|
-
assert_equal(@expected_tail2, File.tail(@test_file, 5))
|
83
|
-
end
|
84
|
-
|
85
|
-
def test_more_lines_than_file
|
86
|
-
assert_equal( @expected_tail_more, File.tail(@test_file, 30) )
|
87
|
-
end
|
88
|
-
|
89
|
-
def test_tail_expected_errors
|
90
|
-
assert_raises(ArgumentError){ File.tail }
|
91
|
-
assert_raises(ArgumentError){ File.tail(@test_file, 5, 5) }
|
92
|
-
end
|
93
|
-
|
94
|
-
def test_no_trailing_newline
|
95
|
-
assert_equal( @expected_tail_trail, File.tail(@test_trail, 2) )
|
96
|
-
assert_equal( @expected_tail_trail, File.tail(@test_trail_nl, 2) )
|
97
|
-
end
|
98
|
-
|
99
|
-
def test_tail_larger_than_64k
|
100
|
-
expected_tail_64k=[]
|
101
|
-
2000.times{ |n| expected_tail_64k.push( @test_tail_fmt_str % (n+1).to_s ) }
|
102
|
-
assert_equal( expected_tail_64k, File.tail(@test_file_64, 2000) )
|
103
|
-
end
|
104
|
-
|
105
|
-
def test_tail_larger_than_128k
|
106
|
-
expected_tail_128k = []
|
107
|
-
4500.times{ |n| expected_tail_128k.push( @test_tail_fmt_str % (n+1).to_s ) }
|
108
|
-
assert_equal( expected_tail_128k, File.tail(@test_file_128, 4500) )
|
109
|
-
end
|
110
|
-
|
111
|
-
def teardown
|
112
|
-
@test_file = nil
|
113
|
-
@expected_tail1 = nil
|
114
|
-
@expected_tail2 = nil
|
115
|
-
end
|
116
|
-
|
117
|
-
def self.shutdown
|
118
|
-
File.delete(@@test_file1) if File.exist?(@@test_file1)
|
119
|
-
File.delete(@@test_file64) if File.exist?(@@test_file64)
|
120
|
-
File.delete(@@test_file128) if File.exist?(@@test_file128)
|
121
|
-
File.delete(@@test_file_trail_nl) if File.exist?(@@test_file_trail_nl)
|
122
|
-
File.delete(@@test_file_trail) if File.exist?(@@test_file_trail)
|
123
|
-
end
|
124
|
-
end
|
data/test/test_touch.rb
DELETED
@@ -1,53 +0,0 @@
|
|
1
|
-
#####################################################################
|
2
|
-
# test_touch.rb
|
3
|
-
#
|
4
|
-
# Test case for the File.touch method. This test should be run
|
5
|
-
# via the 'rake test_touch task'.
|
6
|
-
#####################################################################
|
7
|
-
require 'test-unit'
|
8
|
-
require 'ptools'
|
9
|
-
|
10
|
-
class TC_FileTouch < Test::Unit::TestCase
|
11
|
-
def self.startup
|
12
|
-
@@dirname = File.dirname(__FILE__)
|
13
|
-
@@xfile = File.join(@@dirname, 'test_file1.txt')
|
14
|
-
File.open(@@xfile, 'w'){ |fh| 10.times{ |n| fh.puts "line #{n}" } }
|
15
|
-
end
|
16
|
-
|
17
|
-
def setup
|
18
|
-
@test_file = File.join(@@dirname, 'delete.this')
|
19
|
-
@xfile = File.join(@@dirname, 'test_file1.txt')
|
20
|
-
end
|
21
|
-
|
22
|
-
def test_touch_basic
|
23
|
-
assert_respond_to(File, :touch)
|
24
|
-
assert_nothing_raised{ File.touch(@test_file) }
|
25
|
-
end
|
26
|
-
|
27
|
-
def test_touch_expected_results
|
28
|
-
assert_equal(File, File.touch(@test_file))
|
29
|
-
assert_equal(true, File.exist?(@test_file))
|
30
|
-
assert_equal(0, File.size(@test_file))
|
31
|
-
end
|
32
|
-
|
33
|
-
def test_touch_existing_file
|
34
|
-
stat = File.stat(@xfile)
|
35
|
-
sleep 1
|
36
|
-
assert_nothing_raised{ File.touch(@xfile) }
|
37
|
-
assert_equal(true, File.size(@xfile) == stat.size)
|
38
|
-
assert_equal(false, File.mtime(@xfile) == stat.mtime)
|
39
|
-
end
|
40
|
-
|
41
|
-
def test_touch_expected_errors
|
42
|
-
assert_raises(ArgumentError){ File.touch }
|
43
|
-
end
|
44
|
-
|
45
|
-
def teardown
|
46
|
-
File.delete(@test_file) if File.exist?(@test_file)
|
47
|
-
@test_file = nil
|
48
|
-
end
|
49
|
-
|
50
|
-
def self.shutdown
|
51
|
-
File.delete(@@xfile) if File.exist?(@@xfile)
|
52
|
-
end
|
53
|
-
end
|
data/test/test_wc.rb
DELETED
@@ -1,73 +0,0 @@
|
|
1
|
-
#####################################################################
|
2
|
-
# test_wc.rb
|
3
|
-
#
|
4
|
-
# Test case for the File.wc method. This test should be run via
|
5
|
-
# the 'rake test_wc' task.
|
6
|
-
#####################################################################
|
7
|
-
require 'test-unit'
|
8
|
-
require 'ptools'
|
9
|
-
|
10
|
-
class TC_FileWC < Test::Unit::TestCase
|
11
|
-
def self.startup
|
12
|
-
Dir.chdir('test') if File.exist?('test')
|
13
|
-
File.open('test_file1.txt', 'w'){ |fh| 25.times{ |n| fh.puts "line#{n+1}" } }
|
14
|
-
@@test_file = 'test_file1.txt'
|
15
|
-
end
|
16
|
-
|
17
|
-
def setup
|
18
|
-
@test_file = 'test_file1.txt'
|
19
|
-
end
|
20
|
-
|
21
|
-
test "wc method basic functionality" do
|
22
|
-
assert_respond_to(File, :wc)
|
23
|
-
assert_nothing_raised{ File.wc(@test_file) }
|
24
|
-
end
|
25
|
-
|
26
|
-
test "wc accepts specific optional arguments" do
|
27
|
-
assert_nothing_raised{ File.wc(@test_file, 'bytes') }
|
28
|
-
assert_nothing_raised{ File.wc(@test_file, 'chars') }
|
29
|
-
assert_nothing_raised{ File.wc(@test_file, 'words') }
|
30
|
-
assert_nothing_raised{ File.wc(@test_file, 'lines') }
|
31
|
-
end
|
32
|
-
|
33
|
-
test "argument to wc ignores the case of the option argument" do
|
34
|
-
assert_nothing_raised{ File.wc(@test_file, 'LINES') }
|
35
|
-
end
|
36
|
-
|
37
|
-
test "wc with no option returns expected results" do
|
38
|
-
assert_kind_of(Array, File.wc(@test_file))
|
39
|
-
assert_equal([166,166,25,25], File.wc(@test_file))
|
40
|
-
end
|
41
|
-
|
42
|
-
test "wc with bytes option returns the expected result" do
|
43
|
-
assert_equal(166, File.wc(@test_file, 'bytes'), "Wrong number of bytes")
|
44
|
-
end
|
45
|
-
|
46
|
-
test "wc with chars option returns the expected result" do
|
47
|
-
assert_equal(166, File.wc(@test_file, 'chars'), "Wrong number of chars")
|
48
|
-
end
|
49
|
-
|
50
|
-
test "wc with words option returns the expected result" do
|
51
|
-
assert_equal(25, File.wc(@test_file, 'words'), "Wrong number of words")
|
52
|
-
end
|
53
|
-
|
54
|
-
test "wc with lines option returns the expected result" do
|
55
|
-
assert_equal(25, File.wc(@test_file, 'lines'), "Wrong number of lines")
|
56
|
-
end
|
57
|
-
|
58
|
-
test "wc requires at least on argument" do
|
59
|
-
assert_raises(ArgumentError){ File.wc }
|
60
|
-
end
|
61
|
-
|
62
|
-
test "an invalid option raises an error" do
|
63
|
-
assert_raises(ArgumentError){ File.wc(@test_file, 'bogus') }
|
64
|
-
end
|
65
|
-
|
66
|
-
def teardown
|
67
|
-
@test_file = nil
|
68
|
-
end
|
69
|
-
|
70
|
-
def self.shutdown
|
71
|
-
File.delete(@@test_file) if File.exist?(@@test_file)
|
72
|
-
end
|
73
|
-
end
|