Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Additional test coverage #479

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
9 changes: 9 additions & 0 deletions test/date/test_date.rb
Expand Up @@ -141,4 +141,13 @@ def test_freeze
assert_instance_of(String, d.to_s)
end

def test_submillisecond_comparison
d1 = DateTime.new(2013, 12, 6, 0, 0, Rational(1, 10000))
d2 = DateTime.new(2013, 12, 6, 0, 0, Rational(2, 10000))
# d1 is 0.0001s earlier than d2
assert_equal(-1, d1 <=> d2)
assert_equal(0, d1 <=> d1)
assert_equal(1, d2 <=> d1)
end

end
13 changes: 13 additions & 0 deletions test/ruby/test_dir.rb
Expand Up @@ -249,4 +249,17 @@ def test_home
ENV["LOGDIR"] = env_logdir
end

def test_symlinks_not_resolved
Dir.mktmpdir do |dirname|
FileUtils.cd(dirname) do
FileUtils.mkdir_p('some-dir')
File.write('some-dir/foo', 'some content')
File.symlink('some-dir', 'dir-symlink')

assert_equal [ 'dir-symlink', 'some-dir' ], Dir['*'].sort
assert_equal [ 'dir-symlink', 'some-dir', 'some-dir/foo' ], Dir['**/*'].sort
end
end
end

end
9 changes: 9 additions & 0 deletions test/ruby/test_enumerator.rb
Expand Up @@ -616,5 +616,14 @@ def test_size_for_string
assert_equal 5, 'hello'.each_char.size
assert_equal 5, 'hello'.each_codepoint.size
end

def test_peek_for_enumerator_objects
e = 2.times
assert_equal(0, e.peek)
e.next
assert_equal(1, e.peek)
e.next
assert_raise(StopIteration) { e.peek }
end
end