I'm currently building a suite of unit tests inspired by Mike Clark:
http://clarkware.com/blog/2005/03/18/ruby-learning-test-1-are-you-there-world
Needless to say, I've cloned his repository rather than starting from
scratch. I'm adding comments and my own tests. Hopefully this will one
day be of use to other people, too. Anyway, I'm wondering if anyone has
any unit tests for the following (in particular):
fileutils
pathname
yaml
or any other beginner friendly, well documented tests.
Any contributions or links gratefully accepted.
···
--
Posted via http://www.ruby-forum.com/.
I've got 50 or 60 in Ruby Kickstart
GitHub - JoshCheek/ruby-kickstart: An interactive guide to learning the Ruby programming language. None for stdlib stuff like that,
though.
···
On Fri, Jul 15, 2011 at 2:52 PM, Simon Harrison <simon@simonharrison.net>wrote:
I'm currently building a suite of unit tests inspired by Mike Clark:
http://clarkware.com/blog/2005/03/18/ruby-learning-test-1-are-you-there-world
Needless to say, I've cloned his repository rather than starting from
scratch. I'm adding comments and my own tests. Hopefully this will one
day be of use to other people, too. Anyway, I'm wondering if anyone has
any unit tests for the following (in particular):
fileutils
pathname
yaml
or any other beginner friendly, well documented tests.
Any contributions or links gratefully accepted.
--
Posted via http://www.ruby-forum.com/\.
Please check out http://testfirst.org and the ruby suite at
http://testfirst.org/learn_ruby
Hopefully you can fit your exercises into our framework rather than
building your own. Many hands make light work!
- A
···
On Fri, Jul 15, 2011 at 12:52 PM, Simon Harrison <simon@simonharrison.net> wrote:
I'm currently building a suite of unit tests inspired by Mike Clark:
http://clarkware.com/blog/2005/03/18/ruby-learning-test-1-are-you-there-world
Needless to say, I've cloned his repository rather than starting from
scratch. I'm adding comments and my own tests. Hopefully this will one
day be of use to other people, too. Anyway, I'm wondering if anyone has
any unit tests for the following (in particular):
fileutils
pathname
yaml
or any other beginner friendly, well documented tests.
Any contributions or links gratefully accepted.
--
Posted via http://www.ruby-forum.com/\.
--
Alex Chaffee - alex@stinky.com - http://alexch.github.com
Stalk me: Facebook | http://twitter.com/alexch |
http://alexch.tumblr.com
--
Alex Chaffee - alex@cohuman.com - http://alexch.github.com
Stalk me: Facebook | http://twitter.com/alexch |
http://alexch.tumblr.com
Thanks both for the suggestions, but I prefer unit tests because they
serve as a great reference for the learner. For example I had some help
the other day with string formatting and now they're saved if I ever
need to check how they work (from string_test.rb):
def test_percent_operator_with_leading_zeros
str = "The number is %05d" % 123
assert_equal("The number is 00123", str)
end
def test_percent_operator_with_range_and_leading_zeros
var = (1..5).map do |n|
"Num-%02d" % n
end
assert_equal(["Num-01", "Num-02", "Num-03", "Num-04", "Num-05"],
var)
end
def test_percent_operator_with_two_args
str = "I'm %s and I'm %d years old." % ["simon", 100]
assert_equal("I'm simon and I'm 100 years old.", str)
end
From Mike Clarks blog post
···
==========================
"In the same way that a test is better than a specification, the
language is better than a description of the language. The test is
definitive—when we ask Ruby what the answer to 'Hello! ' * 3 is, we're
going to the horse's mouth. It doesn't matter what the documentation
says; what we're testing is what actually happens. And that's learning.
So the test is both a learning test and a regression test."
--
Posted via http://www.ruby-forum.com/.