[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

undefined method `add_assertion' for nil:NilClass

Paatsch, Bernd

3/22/2006 1:31:00 AM

Hello,

I tried to use assertion's the first time in my code and had absolutely now
success. I always get following error:

TEST FAILED.undefined method `add_assertion' for nil:NilClass
c:/ruby/lib/ruby/1.8/test/unit/testcase.rb:115:in `add_assertion'
c:/ruby/lib/ruby/1.8/test/unit/assertions.rb:353:in `_wrap_assertion'
c:/ruby/lib/ruby/1.8/test/unit/assertions.rb:38:in `assert'
/utils.rb:1376:in `bpVerifyOnPage'

Here is a code snipe (verify is a string that is passed to a function):

The if statement works fine. The assert gives me trouble. Why? What is
wrong? What is the nil class?
I also tried assert(true), assert_equal("1234","1234") with the same result

class BPUtils < Test::Unit::TestCase

def initialize
end

def
.........some code
begin
assert($ie.contains_text( verify ) )
puts("TEST PASSED. Found test string #{verify}")

#if $ie.contains_text( verify ) then
# some
#else
# some code
#end

rescue => e
puts("TEST FAILED." + e.message + "\n" + e.backtrace.join("\n"))


# hand exception over to main program to quit the program
raise QuitProgram, "quit program", caller
end
end


2 Answers

dblack

3/22/2006 2:05:00 AM

0

asdf asdf

9/27/2012 11:05:00 PM

0

On Friday, September 28, 2012 12:22:01 AM UTC+8, Satish wrote:
> On Sep 26, 8:21 pm, rst0 <rst0w...@yahoo.com> wrote:
>
> > Libyan rebel who helped capture Gadhafi dies after torture, kidnapping
>
> > 2012-09-27 01:23:41 GMT2012-09-27 09:23:41(Beijing Time)  SINA.comhttp://english.sina.com/world/2012/0926/5...
>
> >
>
> > One of the Libyan rebels who helped capture Muammar Gaddafi in a drain
>
> > pipe was buried early on Wednesday after his relatives said he had
>
> > been shot and tortured in a rival town.
>
> >
>
> > The death of Omran Shaban on Monday again highlighted the struggle of
>
> > Libya's new leaders to rein in armed groups.
>
> >
>
> > Shaban shot to fame when he was seen in pictures grabbing Gaddafi on
>
> > October 20 before the former Libyan leader was killed in his home town
>
> > of Sirte.
>
> >
>
> > According to his relatives, Shaban was kidnapped by armed men in July
>
> > close to Bani Walid while on his way back to Misrata after he had been
>
> > on government business in western Libya to calm clashes there. Bani
>
> > Walid, a former Gaddafi stronghold, lies some 140 km (90 miles) from
>
> > Misrata.
>
> >
>
> > "He was kidnapped on his way back by some criminal group," his brother
>
> > Walid said. "The lower part of his body had gunshot wounds and he was
>
> > tortured."
>
> >
>
> > Shaban was freed earlier this month after mediation efforts by
>
> > Mohammed Magarief, leader of the ruling national congress. But he was
>
> > in critical condition and died in Paris on Monday.
>
> > Hundreds attended funeral prayers for Shaban in a Misrata football
>
> > stadium.
>
> >
>
> > His brother Hussein complained that the Libyan authorities did nothing
>
> > to help Shaban.
>
> > "Libya was declared liberated of Gaddafi's rule on October 23 last
>
> > year. It isn't," he said.
>
> >
>
> > The national congress has ordered the defense and interior ministries
>
> > to find those who abducted Shaban, calling him a "brave hero".
>
>
>
>
>
>
>
> rstx is mostly into eating crow. That's what his gf cooks for him. But
>
> eating dog is certainly not beneath this dog from Mertced, CA.
>
>
>
> Here's the conversation rst had with his live-in domestic partner,
>
> haghoua, the last time they went out to eat at their favorite Chinese
>
> restaurant - a Cantonese restaurant founded by rst's great great
>
> grandfather in the 19th century. It is very popular with the rst clan
>
> in Merced, CA:
>
>
>
>
>
> haghoua:
>
>
>
> ???????????- Tian a. Zhè cài li shì shénme a?
>
>
>
> rst:
>
>
>
> ?!????? - È! Shì zhi zhangláng.
>
>
>
> haghoua:
>
>
>
> ?????! - Zhen tài exin le!
>
>
>
> rst:
>
>
>
> ????????????????? - Women gàosù fúwùsheng ba. Ta huì gei ni huàn
>
> yífèn de.
>
>
>
> haghoua:
>
>
>
> ?????!???????????? - Wo bùxiang huàn le! Wo juédé chi bú xià rèrhé
>
> dongxi le.
>
>
>
> rst:
>
>
>
> ?????????????????????- Hao ba. Women qù gen canguan jingli fanyìng
>
> yíxià zhègè wèntí ba.
>
>
>
> haghoua:
>
>
>
> ???????????????- Hao.. Xiwàng tamen yihòu zhùyì dianr wèisheng.
>
>
>
>
>
> Note that rstx was quite contented with what he was served - he wanted
>
> an alternate dish for his domestic partner, haghoua, only.

http://www.barghouti.com/islam/me...