John Nolan
2010-Feb-23 09:04 UTC
[Ironruby-core] Getting started with IronRuby and c# issues
Thanks Mark. The problem was definitely in the wetwear. I think the thing that threw me off was RubyMine was complaining about my namespace. Interestingly for me though both: assert_equal("John",john.FirstName) and assert_equal("John",john.first_name) work. John(no) On 22 February 2010 23:46, <ironruby-core-request at rubyforge.org> wrote:> Send Ironruby-core mailing list submissions to > ironruby-core at rubyforge.org > > To subscribe or unsubscribe via the World Wide Web, visit > http://rubyforge.org/mailman/listinfo/ironruby-core > or, via email, send a message with subject or body ''help'' to > ironruby-core-request at rubyforge.org > > You can reach the person managing the list at > ironruby-core-owner at rubyforge.org > > When replying, please edit your Subject line so it is more specific > than "Re: Contents of Ironruby-core digest..." > > > Today''s Topics: > > 1. Getting started with IronRuby and c# issues. (John Nolan) > 2. Re: Getting started with IronRuby and c# issues. (Mark Ryall) > 3. Code Review: Buffer7 (Tomas Matousek) > > > ---------------------------------------------------------------------- > > Message: 1 > Date: Sat, 20 Feb 2010 10:16:16 +0000 > From: John Nolan <johnnonolan at gmail.com> > To: ironruby-core at rubyforge.org > Subject: [Ironruby-core] Getting started with IronRuby and c# issues. > Message-ID: > <ea290a9d1002200216l1d0fd09cr41166b37a3a1cdd5 at mail.gmail.com> > Content-Type: text/plain; charset="iso-8859-1" > > Hi IronRuby mailing list, > > Inspired by a talk by Ben Hall on testing c# with Ruby I thought I''d give > it > a go but > I''m frustratingly stuck at the first hurdle. I''ve emailed Ben but as I''ve > not had an immediate response I thought I''d open it to you good people. > > Any way. I thought I''d start off simple and follow Dom Green''s blog. > domgreen.com/2010/02/07/pumping-iron-ruby-net-testing/ > > He''s set a class in c# with a simple property (here''s mine) > > namespace IronRubyAndCSharp > { > public class Person > { > public string FirstName { get; set; } > > public Person(string name) > { > FirstName = name; > } > } > } > > and tested it like so > > require "test/unit" > require "../IronRuby/bin/debug/IronRubyAndCSharp.dll" > > class PersonTest < Test::Unit::TestCase > include IronRubyAndCSharp > def test_create_person_called_john > john = Person.new("John") > assert_not_nil(john) > assert_equal("John",Person.FirstName) > end > end > > RubyMine(RM) has no problem with the require of the dll but it does have a > problem recognising the namespace "IronRubyAndCSharp" > and the Person class (squiggly lines ahoy). > > When I run the tests in RM I get > > NoMethodError: undefined method `FirstName'' for > IronRubyAndCSharp::Person:Class > C:/Users/John/Documents/IronRuby/Tests/Person_test.rb:14:in > `test_create_person_called_john'' > :0:in `send'' > :0:in `each'' > C:/Program Files (x86)/IronRuby > 0.9.4.0/Lib/ruby/1.8/test/unit/ui/testrunnermediator.rb:46:in `run_suite'' > :0:in `each'' > C:\Program Files (x86)\JetBrains\RubyMine > 2.0.1\rb\testing\patch\testunit/test/unit/ui/testrunnermediator.rb:36:in > `run_suite'' > testrunner.rb:213:in `start_mediator'' > C:\Program Files (x86)\JetBrains\RubyMine > 2.0.1\rb\testing\patch\testunit/test/unit/ui/teamcity/testrunner.rb:191:in > `start'' > testrunnerutilities.rb:28:in `run'' > C:/Program Files (x86)/IronRuby > 0.9.4.0/Lib/ruby/1.8/test/unit/autorunner.rb:216:in `run'' > C:/Program Files (x86)/IronRuby > 0.9.4.0/Lib/ruby/1.8/test/unit/autorunner.rb:12:in `run'' > > Just in case RubyMine was at fault I dropped out to good old ir.exe > > C:\Users\John\Documents\IronRuby\Tests>ir Person_test.rb --name > test_create_pers > on_called_john > Loaded suite Person_test > Started > E > Finished in 0.041992 seconds. > > 1) Error: > test_create_person_called_john(PersonTest): > NoMethodError: undefined method `FirstName'' for > IronRubyAndCSharp::Person:Class > Person_test.rb:14:in `test_create_person_called_john'' > :0:in `send'' > :0:in `each'' > :0:in `each'' > testrunner.rb:66:in `start_mediator'' > testrunnerutilities.rb:28:in `run'' > > 1 tests, 1 assertions, 0 failures, 1 errors > > I''ve stuck my code up on github > http://github.com/johnnonolan/IronRubyAndCSharp if you feel that was > inclined. > > Any pointers, help or whatever much appreciated. > > PlzSendMeTehCodez > > > John(no) > -------------- next part -------------- > An HTML attachment was scrubbed... > URL: < > http://rubyforge.org/pipermail/ironruby-core/attachments/20100220/84e2a62f/attachment-0001.html > > > > ------------------------------ > > Message: 2 > Date: Sat, 20 Feb 2010 21:26:40 +1100 > From: Mark Ryall <mark.ryall at gmail.com> > To: ironruby-core at rubyforge.org > Subject: Re: [Ironruby-core] Getting started with IronRuby and c# > issues. > Message-ID: > <43769a4a1002200226g1585c8c6vdec3521b9c809a51 at mail.gmail.com> > Content-Type: text/plain; charset="iso-8859-1" > > ironruby will have ''rubified'' the Person class''s FirstName method to > first_name and I think you mean to assert against the john instance of > Person (rather than the Person class). > > Otherwise it looks pretty close. > > Try: > > require "test/unit" > require "../IronRuby/bin/debug/IronRubyAndCSharp.dll" > > class PersonTest < Test::Unit::TestCase > include IronRubyAndCSharp > def test_create_person_called_john > john = Person.new("John") > assert_not_nil(john) > assert_equal("John",john.first_name) > end > end > > On Sat, Feb 20, 2010 at 9:16 PM, John Nolan <johnnonolan at gmail.com> wrote: > > Hi IronRuby mailing list, > > Inspired by a talk by Ben Hall on testing c# with Ruby I thought I''d give > it > > a go but > > I''m frustratingly stuck at the first hurdle. I''ve emailed Ben but as I''ve > > not had an immediate response I thought I''d open it to you good people. > > Any way. I thought I''d start off simple and follow Dom Green''s > > blog. domgreen.com/2010/02/07/pumping-iron-ruby-net-testing/ > > He''s set a class in c# with a simple property (here''s mine) > > namespace IronRubyAndCSharp > > { > > public class Person > > { > > public string FirstName { get; set; } > > public Person(string name) > > { > > FirstName = name; > > } > > } > > } > > and tested it like so > > require "test/unit" > > require "../IronRuby/bin/debug/IronRubyAndCSharp.dll" > > class PersonTest < Test::Unit::TestCase > > include IronRubyAndCSharp > > def test_create_person_called_john > > john = Person.new("John") > > assert_not_nil(john) > > assert_equal("John",Person.FirstName) > > end > > end > > RubyMine(RM) has no problem with the require of the dll but it does have > a > > problem recognising the namespace "IronRubyAndCSharp" > > and the Person class (squiggly lines ahoy). > > When I run the tests in RM I get > > NoMethodError: undefined method `FirstName'' for > > IronRubyAndCSharp::Person:Class > > C:/Users/John/Documents/IronRuby/Tests/Person_test.rb:14:in > > `test_create_person_called_john'' > > :0:in `send'' > > :0:in `each'' > > C:/Program Files > > (x86)/IronRuby > 0.9.4.0/Lib/ruby/1.8/test/unit/ui/testrunnermediator.rb:46:in `run_suite'' > > :0:in `each'' > > C:\Program Files (x86)\JetBrains\RubyMine > > 2.0.1\rb\testing\patch\testunit/test/unit/ui/testrunnermediator.rb:36:in > > `run_suite'' > > testrunner.rb:213:in `start_mediator'' > > C:\Program Files (x86)\JetBrains\RubyMine > > > 2.0.1\rb\testing\patch\testunit/test/unit/ui/teamcity/testrunner.rb:191:in > > `start'' > > testrunnerutilities.rb:28:in `run'' > > C:/Program Files > > (x86)/IronRuby 0.9.4.0/Lib/ruby/1.8/test/unit/autorunner.rb:216:in `run'' > > C:/Program Files > > (x86)/IronRuby 0.9.4.0/Lib/ruby/1.8/test/unit/autorunner.rb:12:in `run'' > > Just in case RubyMine was at fault I dropped out to good old ir.exe > > C:\Users\John\Documents\IronRuby\Tests>ir Person_test.rb --name > > test_create_pers > > on_called_john > > Loaded suite Person_test > > Started > > E > > Finished in 0.041992 seconds. > > 1) Error: > > test_create_person_called_john(PersonTest): > > NoMethodError: undefined method `FirstName'' for > > IronRubyAndCSharp::Person:Class > > Person_test.rb:14:in `test_create_person_called_john'' > > :0:in `send'' > > :0:in `each'' > > :0:in `each'' > > testrunner.rb:66:in `start_mediator'' > > testrunnerutilities.rb:28:in `run'' > > 1 tests, 1 assertions, 0 failures, 1 errors > > I''ve stuck my code up on > > github http://github.com/johnnonolan/IronRubyAndCSharp if you feel that > was > > inclined. > > Any pointers, help or whatever much appreciated. > > PlzSendMeTehCodez > > > > John(no) > > _______________________________________________ > > Ironruby-core mailing list > > Ironruby-core at rubyforge.org > > http://rubyforge.org/mailman/listinfo/ironruby-core > > > > > -------------- next part -------------- > An HTML attachment was scrubbed... > URL: < > http://rubyforge.org/pipermail/ironruby-core/attachments/20100220/76149074/attachment-0001.html > > > > ------------------------------ > > Message: 3 > Date: Mon, 22 Feb 2010 23:46:23 +0000 > From: Tomas Matousek <Tomas.Matousek at microsoft.com> > To: IronRuby External Code Reviewers <irbrev at microsoft.com> > Cc: "ironruby-core at rubyforge.org" <ironruby-core at rubyforge.org> > Subject: [Ironruby-core] Code Review: Buffer7 > Message-ID: > < > 4B342496A3EFEB48839E10BB4BF5964C3DB7C760 at TK5EX14MBXC122.redmond.corp.microsoft.com > > > > Content-Type: text/plain; charset="us-ascii" > > tfpt review "/shelveset:Buffer7;REDMOND\tomat" > Comment : > Improves perf of IO#each_line. > Fixes a few socket specs. > > Fixes: > http://ironruby.codeplex.com/WorkItem/View.aspx?WorkItemId=3314 > http://ironruby.codeplex.com/WorkItem/View.aspx?WorkItemId=3231 > > Tomas > -------------- next part -------------- > A non-text attachment was scrubbed... > Name: Buffer7.diff > Type: application/octet-stream > Size: 58628 bytes > Desc: Buffer7.diff > URL: < > http://rubyforge.org/pipermail/ironruby-core/attachments/20100222/05730632/attachment.obj > > > > ------------------------------ > > _______________________________________________ > Ironruby-core mailing list > Ironruby-core at rubyforge.org > http://rubyforge.org/mailman/listinfo/ironruby-core > > > End of Ironruby-core Digest, Vol 30, Issue 60 > ********************************************* >-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://rubyforge.org/pipermail/ironruby-core/attachments/20100223/0f77e9a6/attachment.html>