# Changes to extname\_spec.rb

**URL:** <https://www.ruby-forum.com/t/changes-to-extname-spec-rb/137550>\
**Category:** IronRuby\
**Created:** [May 14, 2008, 5:39am UTC](https://www.ruby-forum.com/t/changes-to-extname-spec-rb/137550 "2008-05-14T05:39:43Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![ksunair](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/k/b19c9b/32.png) [@ksunair](https://www.ruby-forum.com/u/ksunair)\
**Post date:** [May 14, 2008, 5:39am UTC](https://www.ruby-forum.com/t/changes-to-extname-spec-rb/137550/1 "2008-05-14T05:39:43Z")

</div>

One more spec change. Could you please review line 8 of this spec, it  
should read  
Â Â Â File.extname(".bashrc").should == “.bashrc”  
instead of  
Â Â Â File.extname(".bashrc").should == “”  
Please see the change in the attached spec file.  
Thanks.

---

<div class="post-metadata">

**Author:** ![ksunair](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/k/b19c9b/32.png) [@ksunair](https://www.ruby-forum.com/u/ksunair)\
**Post date:** [May 14, 2008, 1:08pm UTC](https://www.ruby-forum.com/t/changes-to-extname-spec-rb/137550/2 "2008-05-14T13:08:55Z")

</div>

Unnikrishnan N. wrote:

> One more spec change. Could you please review line 8 of this spec, it  
> should read
> 
> ```
> File.extname(".bashrc").should == ".bashrc"
> 
> ```
> 
> instead of
> 
> ```
> File.extname(".bashrc").should == ""
> 
> ```

Quick question: are the specs supposed to ensure that IronRuby matches  
MRI’s behaviour, or just that it’s internally consistent? I get this in  
MRI’s IRB:

irb(main):001:0\> File.extname(".bashrc")  
=\> “”

Also in YARV:

irb(main):002:0\> File.extname(".bashrc")  
=\> “”

---

<div class="post-metadata">

**Author:** ![ksunair](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/k/b19c9b/32.png) [@ksunair](https://www.ruby-forum.com/u/ksunair)\
**Post date:** [May 14, 2008, 1:43pm UTC](https://www.ruby-forum.com/t/changes-to-extname-spec-rb/137550/3 "2008-05-14T13:43:03Z")

</div>

I have been working on the basis that MRI is the reference  
implementation  
and so the specs should reflect that. If, on writing a spec, an obvious  
bug  
is exposed then we should be sending this on to the RubyLang lot and  
getting  
them to fix it.

Otherwise if it’s good enough for MRI its good enough for me.

* * *

By the way, I had this idea of creating a small program that would help  
with  
regression testing against MRI. Instead of writing full RSpecs, we  
should  
write snippets of Ruby that work the classes. The program would then  
run  
the snippets against MRI and IronRuby (and any other implementation if  
you  
wanted) and compare the results. That way you could directly check how  
similar IR was to MRI without having to fix up the specs all the time.  
Also  
it would be much quicker and easier to write the specs since you  
wouldn’t  
have to check what the correct result should be in each case.

For instance, you could have the following snippets of code for the  
Fixnum#div method:

```
2.div(2)
1.div(2)
5.div(2)

8192.div(10)
8192.div(-10)
(-8192).div(10)
(-8192).div(-10)

1.div(0.2)
1.div(0.16)
1.div(0.169)
-1.div(50.4)
1.div(0xffffffff)

0.div(0.0)
10.div(0.0)
-10.div(0.0)
13.div(0)
(obj = Object.new).should_receive(:to_int, :count => 0, :returning 

```

=\>  
10)  
13.div(obj)  
5.div(“2”)

Obviously with some description mechanism and possibly some way of  
specifying what should be considered in the output from Ruby: whether to  
check the class and value of results returned; type and fields of  
objects  
passed in; if errors are raised the type and message of the error.

Anyone fancy knocking this up?  
Pete

---

<div class="post-metadata">

**Author:** ![ksunair](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/k/b19c9b/32.png) [@ksunair](https://www.ruby-forum.com/u/ksunair)\
**Post date:** [May 14, 2008, 4:32pm UTC](https://www.ruby-forum.com/t/changes-to-extname-spec-rb/137550/4 "2008-05-14T16:32:04Z")

</div>

Peter Bacon D.:

> By the way, I had this idea of creating a small program that would help  
> with regression testing against MRI. Instead of writing full RSpecs,  
> we should write snippets of Ruby that work the classes. The program  
> would then run the snippets against MRI and IronRuby (and any other  
> implementation if you  
> wanted) and compare the results. That way you could directly check how  
> similar IR was to MRI without having to fix up the specs all the time.  
> Also it would be much quicker and easier to write the specs since you  
> wouldn’t have to check what the correct result should be in each case.

This is a great idea. We already do something similar with the suite of  
check-in tests that we wrote (I need to fix these so they run on the  
external layout). But if you look at the code inside of run.rb and  
friends inside of the tests directory you’ll see us doing exactly this  
between MRI, desktop CLR and Silverlight CLR.

Thanks,  
-John
