Eric Torreborre | 1 Jan 2008 01:48
Picon
Favicon
Gravatar

Re: Scala Unit Testing


Hi Ola,

Here is  http://www.nabble.com/file/p14563192/specs-ant-example.rar an Ant
build file  that you can use as a starter to compile with scalac and test
with the junit ant task. Please change the paths to the relevant jars on
your installation.

You can try it just test by executing the default task:

C:\projects\specs-test>ant
Buildfile: build.xml

compile:
   [scalac] Compiling 1 source file to C:\projects\specs-test\target\classes

test:
    [junit] Testsuite: org.user.LexerTest
    [junit] Tests run: 1, Failures: 0, Errors: 0, Time elapsed: 0 sec

BUILD SUCCESSFUL
Total time: 4 seconds

And if you introduce a failure in the test, like "true must beFalse", you
would have:

C:\projects\specs-test>ant
Buildfile: build.xml

compile:
(Continue reading)

Eric Torreborre | 1 Jan 2008 02:08
Picon
Favicon
Gravatar

Re: Scala Unit Testing


The wiki is updated here:

http://code.google.com/p/specs/wiki/RunningSpecs#Run_your_specification_with_JUnit3_and_Ant

Eric.
--

-- 
View this message in context: http://www.nabble.com/Scala-Unit-Testing-tp14560308p14563313.html
Sent from the Scala - Lounge mailing list archive at Nabble.com.

Ola Bini | 1 Jan 2008 02:20
Picon
Gravatar

Re: Scala Unit Testing

Eric Torreborre wrote:
> Hi Ola,
>
> Here is  http://www.nabble.com/file/p14563192/specs-ant-example.rar an Ant
> build file  that you can use as a starter to compile with scalac and test
> with the junit ant task. Please change the paths to the relevant jars on
> your installation.
>
>   
Thanks very much Eric,

I'll take a look and get it integrated. The thing is, this looks exactly 
what I had earlier, which didn't work.

And now I've integrated it and tried it. The only thing I did was change 
the org.user package to org.sciom and use my own classpath elements. I 
get exactly the same failure:

    [junit] Testsuite: org.sciom.LexerTest
    [junit] Tests run: 1, Failures: 0, Errors: 1, Time elapsed: 0.008 sec
    [junit]
    [junit] Testcase: initializationError0(org.sciom.LexerTest):        
Caused an ERROR
    [junit] No runnable methods
    [junit] java.lang.Exception: No runnable methods
    [junit]     at 
java.lang.reflect.Constructor.newInstance(Constructor.java:506)
    [junit]     at 
java.lang.reflect.Constructor.newInstance(Constructor.java:506)

(Continue reading)

Eric Torreborre | 1 Jan 2008 02:59
Picon
Favicon
Gravatar

Re: Scala Unit Testing


I've just tried with Java 6, Ant 1.7.0 (I was using 1.6.5 before) and it
works.

Do you have the JUnit4 library in your $ANT_HOME/lib directory?

I've never tried using JUnit4 so I'll try that to see if I can reproduce
your error.

Eric.

Ola Bini-3 wrote:
> 
> Eric Torreborre wrote:
>> Hi Ola,
>>
>> Here is  http://www.nabble.com/file/p14563192/specs-ant-example.rar an
>> Ant
>> build file  that you can use as a starter to compile with scalac and test
>> with the junit ant task. Please change the paths to the relevant jars on
>> your installation.
>>
>>   
> Thanks very much Eric,
> 
> I'll take a look and get it integrated. The thing is, this looks exactly 
> what I had earlier, which didn't work.
> 
> And now I've integrated it and tried it. The only thing I did was change 
> the org.user package to org.sciom and use my own classpath elements. I 
(Continue reading)

Eric Torreborre | 1 Jan 2008 03:05
Picon
Favicon
Gravatar

Re: Scala Unit Testing


Yes, I get the same error by putting the junit4.4 jar (as junit.jar) in the
$ANT_HOME/lib directory.
Now I think I have to investigate how the compatibility mode works.

Eric.
--

-- 
View this message in context: http://www.nabble.com/Scala-Unit-Testing-tp14560308p14563912.html
Sent from the Scala - Lounge mailing list archive at Nabble.com.

Ola Bini | 1 Jan 2008 03:12
Picon
Gravatar

Re: Scala Unit Testing

Eric Torreborre wrote:
> Yes, I get the same error by putting the junit4.4 jar (as junit.jar) in the
> $ANT_HOME/lib directory.
> Now I think I have to investigate how the compatibility mode works.
>
> Eric.
>   
Interesting. I couldn't find any JUnit 4 on my classpath. But it seems 
to be there.

I would say it would be extremely simple for you to support JUnit4 
transparently. Hopefully, that is. =)

Cheers

--

-- 
 Ola Bini (http://ola-bini.blogspot.com) 
 JRuby Core Developer
 Developer, ThoughtWorks Studios (http://studios.thoughtworks.com)
 Practical JRuby on Rails (http://apress.com/book/view/9781590598818)

 "Yields falsehood when quined" yields falsehood when quined.

Oliver Lambert | 1 Jan 2008 04:30
Picon

[lift] Re: [scala-lounge] [ANN] A blog post about Scala's dynamic side

Hi David,

This is really cool - thanks!  Maybe I will eventually start to understand Scala.

Could you, or some other kind person, explain -

def nameAndAge(in: Seq[{def name: String; def age: Int}]) = 
    in.map(in => in.name+" is "+in.age+" years old").mkString("\n")

Is this, an anonymous trait?

cheers
Oliver

On 31/12/2007, at 11:30 AM, David Pollak wrote:

http://scala-blogs.org/2007/12/scala-statically-typed-dynamic-language.html


--
lift, the secure, simple, powerful web framework http://liftweb.net
Collaborative Task Management http://much4.us


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "liftweb" group.
To post to this group, send email to liftweb <at> googlegroups.com
To unsubscribe from this group, send email to liftweb-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at http://groups.google.com/group/liftweb?hl=en
-~----------~----~----~----~------~----~------~--~---

Tony Morris | 1 Jan 2008 04:36
Favicon

Re: [ANN] A blog post about Scala's dynamic side


Oliver Lambert wrote:
> Hi David,
> 
> This is really cool - thanks!  Maybe I will eventually start to
> understand Scala.
> 
> Could you, or some other kind person, explain -
> 
>     def nameAndAge(in: Seq[{def name: String; def age: Int}]) =
>             in.map(in => in.name+" is "+in.age+" years old").mkString("\n")
> 
> Is this, an anonymous trait?

Hi Oliver,
This is a language feature called Structural Typing, introduced in
2.6.0. The type of the argument to the function may be read as: "a Seq
of any type that supports the name and age functions (of the given type)".

It is similar to duck typing in other languages, except the type checker
will enforce that the type over which the Seq is defined, does indeed
support those methods when that method is called. Those methods are
called in the lambda (within map) on the type that supports them.

--
Tony Morris
http://tmorris.net/

Hey! We had 40,000 lines of C# here yesterday, but now there are 40
lines of... Dear God, what is a catamorphism?"
Jay donnell | 1 Jan 2008 05:26

classpath and scala scripts

I'm trying to run a scala script that imports from a couple of  
packages. This is an eclipse project and I created a runner.scala  
script in the src directory which imports the eclipse application and  
calls the main method.

runner.scala
-----------------
import SearchStats.SearchStats

SearchStats.main(new Array[String](0))

The folder setup is simple.
src/runner.scala
src/SearchStats/SearchStats.scala

Everything works fine if I run it from the src directory.
$ scala runner.scala

But I run into problems if I try to run it from a different directory  
even if I set the classpath. I'm wondering what I'm doing wrong with  
the classpath. If I cd .. from src and run:

$ scala -classpath /Users/jay/projects/gmScripts/SearchStats/src src/ 
runner.scala
(fragment of runner.scala):1: error: SearchStats is not a member of  
SearchStats
import SearchStats.SearchStats
         ^
(fragment of runner.scala):3: error: value jay is not a member of  
package SearchStats
SearchStats.jay
              ^
two errors found

What am I doing wrong?

Andrew Gaydenko | 1 Jan 2008 18:07

Re: reading for ordinary java programmer

David,

Thanks! Am reading, but already want more ;-)

P.S. BTW, I have tried 'rlwrap' with Konsole and have got rather strange 
behavior. Which term do you use?

----------

David and All,

If to say about "more theoretical" background, I'm trying to dig in John 
Harrison's "Introduction to FP" also. Saying more common, I feel, to 
understand all Scala's power I need to learn, say, Haskell. But am afraid it 
is too time-costly way. Thoughts?

Andrew Gaydenko

======= On Monday 31 December 2007, David Pollak wrote: =======
> Andrew,
>
> Here are some links that might help:
> http://blog.lostlake.org/index.php?/archives/60-Thinking-functional-
> Scala-imperative-vs.-functional-code.html
> http://blog.lostlake.org/index.php?/archives/50-The-Scala-Option-
> class-and-how-lift-uses-it.html
> http://blog.lostlake.org/index.php?/archives/50-The-Scala-Option-
> class-and-how-lift-uses-it.html
> http://blog.lostlake.org/index.php?/archives/41-Scala-Idioms,-Step-1,-
> Lists-and-Maps.html
> http://blog.lostlake.org/index.php?/archives/38-Introducing-Scala,-
> Step-2.html
> http://blog.lostlake.org/index.php?/archives/36-Introducing-Scala,-
> Step-1.html
> http://metacircular.wordpress.com/2007/01/15/example-using-java-
> libraries-to-manipulate-regular-expressions/
>
> You might want to reverse the order you read them in (bottom to
> top). :-)
>
> Thanks,
>
> David
>
> On Dec 31, 2007, at 4:29 AM, Andrew Gaydenko wrote:
> > Hi!
> >
> > Scala mailing lists, articles, blogs often include something not
> > familiar
> > for "ordinary" java programmer (folding, category, monad, ... you
> > say). Are
> > there publically available resources to (at least partially) refill
> > knowledge
> > lack? I dont mean some kind of 1000 pages books.
> >
> > Heh, the language is so exciting even without deep understanding! ;-)
> >
> >
> > Andrew Gaydenko
>
> --
> David Pollak
> http://blog.lostlake.org


Gmane