From: Dark Ambient Date: 2006-07-05T21:22:02+09:00 Subject: Re: Pickaxe code error Back again on this one, still getting a test delete failure. 1) Failure: test_delete(TestSongList) [pickaxe_p23.rb:137]: <#> expected but was . Not sure what this means exactly? Anyone else have this issue or remember the section of the book ? Stuart 1 tests, 1 assertions, 1 failures, 0 errors On 7/5/06, Dark Ambient wrote: > Just realized that this needed to be in with the rest of the previous > jukebox code. > Sorry - ignore. > > Stuart > > On 7/5/06, Dark Ambient wrote: > > Not sure what's going on with some code in Programming Ruby, it's > > early on where a SongList container is being created and test units > > are run. > > I'm receiving this error: > > > > 1) Error: > > test_delete(TestSongList): > > NameError: uninitialized constant TestSongList::Song > > pickaxe_SongListContainer.rb:52:in `test_delete' > > > > the rb:52 won't be right as I've put notes in comments between the > > code, which I'm stripping here. Perhaps someone is familiar with > > example. I checked errata with no luck..TIA > > > > require 'test/unit' > > > > class SongList > > def initialize > > @songs = Array.new > > end > > > > def append(song) > > #songs.push(song) > > self > > end > > > > def delete_first > > @songs.shift > > end > > > > def delete_last > > @songs.pop > > end > > > > def [](index) > > @songs[index] > > end > > end > > > > > > class TestSongList < Test::Unit::TestCase > > def test_delete > > list = SongList.new > > s1 = Song.new('title1', 'artist1', 1) > > s2 = Song.new('title2', 'artist2', 2) > > s3 = Song.new('title3', 'artist3', 3) > > s4 = Song.new('title4', 'artist4', 4) > > > > list.append(s1).append(s2).append(s3).append(s4) > > > > assert_equal(s1, list[0]) > > assert_equal(s3, list[2]) > > assert_nil(list[9]) > > > > assert_equal(s1, list.delete_first) > > assert_equal(s2, list.delete_first) > > assert_equal(s4, list.delete_last) > > assert_equal(s3, list.delete_last) > > assert_nil(list.delete_last) > > end > > end > > > > > >