Skip to content

Commit 405dab3

Browse files
committed
chapter04 The Test::Unit Testing Framework #1
first writing test file read compare character
1 parent 024821c commit 405dab3

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

chapter04/data.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
Bradman 99.94 52 80 10 6996 334 29
2+
Pollock 60.97 23 41 4 2256 274 7
3+
Headley 60.83 22 40 4 2256 270* 10
4+
Sutcliffe 60.73 54 84 9 4555 194 16

chapter04/file_test.rb

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
require "test/unit"
2+
3+
class RunFileTest < Test::Unit::TestCase
4+
def test_read_4th_character
5+
contents = File.read('data.txt')
6+
assert_equal 'd', contents[3, 1]
7+
end
8+
end

0 commit comments

Comments
 (0)