Static testing for Scala -
There are some good libraries for testing in Scala (,,). However, with the powerful type system of Scala, the critical part of an API developed in Scala is expressed steadily, usually being prevented by the compiler as some undesirable or unapproved behavior.
So, what is the best way to check that somebody is stopped by the compiler while designing a library or other API? This code is dissatisfied to comment outside, which should be incompatible and then it must be tailored to verify it.
A responsive example test list:
val list: list [int] = list (1, 2, 3) // // list.add (" Chika-boom-boom ") should not be compiled
Does one of the current test libraries handle issues like this? Is there any way people use that work?
The approach I was thinking was to embed the code into a triple-coat string or XML element and in my trial the call was to the compiler. The calling code is showing something like this:
should
Or, on the lines of any type of script that calls on the interpreter.
I have made some specs to execute some code snippets and check the results of the interpreter.
You can see the attribute. This idea is the code executing some org.specs.util.Property [snippet]:
this value: property [snippet] = property (snippet ("")) "Import Scala .collection.List "prelude it // it will be preended for any code in the snippet" WAL list: list [int] = list (1, 2, 3) "This cutting / some code (maintenance of some time)" List .add ("Chikka-Chikka-Boom-Boom") "Add / code some code before code first. A new kickie would execute the previous code (except the preamble) (this should include) ("Error: value is not a member of the index [int]") // Check interpreter output
< P> The main drawback I received with this approach was the slow pace of the interpreter. I do not yet know how it can be extended. Eric.
Comments
Post a Comment