- About Scala
- Documentation
- Code Examples
- Software
- Scala Developers
Anyway to evaluate a string as Scala code
Wed, 2009-12-09, 01:14
Hi,
I'm writing a tool that generates Scala code and I'm wanting to unit test it. I'm currently using JUnit.
Ideally, I'd like to generate Scala code in my JUnit test and send it to a Scala interpreter to run and then be able to determine if there are any errors in the generated code from my JUnit test case.
What's the best way to go about this?
Thanks,
-John
I'm writing a tool that generates Scala code and I'm wanting to unit test it. I'm currently using JUnit.
Ideally, I'd like to generate Scala code in my JUnit test and send it to a Scala interpreter to run and then be able to determine if there are any errors in the generated code from my JUnit test case.
What's the best way to go about this?
Thanks,
-John
Wed, 2009-12-09, 03:47
#2
Re: Anyway to evaluate a string as Scala code
On 09/12/2009, at 11:13 AM, John Ky wrote:
> I'm writing a tool that generates Scala code and I'm wanting to unit test it. I'm currently using JUnit.
>
> Ideally, I'd like to generate Scala code in my JUnit test and send it to a Scala interpreter to run and then be able to determine if there are any errors in the generated code from my JUnit test case.
>
> What's the best way to go about this?
Specs has support for this kind of thing. For starters, check out:
http://stackoverflow.com/questions/1857999/static-testing-for-scala
cheers,
Tony
Wed, 2009-12-09, 07:07
#3
Re: Anyway to evaluate a string as Scala code
Cool! Thanks!
On Wed, Dec 9, 2009 at 1:36 PM, Tony Sloane <inkytonik@gmail.com> wrote:
On Wed, Dec 9, 2009 at 1:36 PM, Tony Sloane <inkytonik@gmail.com> wrote:
On 09/12/2009, at 11:13 AM, John Ky wrote:
> I'm writing a tool that generates Scala code and I'm wanting to unit test it. I'm currently using JUnit.
>
> Ideally, I'd like to generate Scala code in my JUnit test and send it to a Scala interpreter to run and then be able to determine if there are any errors in the generated code from my JUnit test case.
>
> What's the best way to go about this?
Specs has support for this kind of thing. For starters, check out:
http://stackoverflow.com/questions/1857999/static-testing-for-scala
cheers,
Tony
As a starting point you might want to check this:
http://old.nabble.com/Compiler-API-to12050645.html#a12050645
Dimitris
2009/12/9 John Ky :
> Hi,
>
> I'm writing a tool that generates Scala code and I'm wanting to unit test
> it. I'm currently using JUnit.
>
> Ideally, I'd like to generate Scala code in my JUnit test and send it to a
> Scala interpreter to run and then be able to determine if there are any
> errors in the generated code from my JUnit test case.
>
> What's the best way to go about this?
>
> Thanks,
>
> -John
>
>