Running a single test from ScalaTest Eclipse plugin doesn't work for FlatSpec

28 views
Skip to first unread message

Devendra Jaisinghani

unread,
May 18, 2017, 12:20:23 AM5/18/17
to scalatest-users
Hi,

Since upgrading to ScalaTest 3.0.x, I noticed that running single tests from within eclipse doesn't work anymore (Right click on a test and then Run As -> ScalaTest - Test).

This seems to happen only with FlatSpec regardless of the verb (must or should). This was a bug seen and fixed earlier (How to run a single test (run/debug?) from the UI in the Eclipse plugin?). 

For reference here's the code taken from the user guide that reproduces the problem:

import org.scalatest.FlatSpec
class SetSpec extends FlatSpec {
 
"An empty Set" should "have size 0" in {
   
assert(Set.empty.size == 0)
 
}
 
 it should
"produce NoSuchElementException when head is invoked" in {
   assertThrows
[NoSuchElementException] {
     
Set.empty.head
   
}
 
}
}

The error message is:
Could not write file: /Users/devendra/code/drj/ws/polaris/.metadata/.plugins/org.eclipse.debug.core/.launches/MethodInvocation(com.drj.polaris.scratch.SetSpec,convertToStringMustWrapperForVerb,class SetSpec extends org.scalatest.FlatSpec {
  def -init-()- com.drj.polaris.scratch.SetSpec = {
    SetSpec.super.-init-();
    ()
  };
  SetSpec.this.convertToInAndIgnoreMethods(SetSpec.this.convertToStringMustWrapperForVerb('An empty Set')(source.this.Position.here).must('have size 0')(SetSpec.this.shorthandTestRegistrationFunction)).in(SetSpec.this.assert(scala.Predef.Set.empty[Nothing].size.==(0))(scalactic.this.Prettifier.default, source.this.Position.here))(source.this.Position.here);
  SetSpec.this.it.must('produce NoSuchElementException when head is invoked').in(SetSpec.this.assertThrows[NoSuchElementException](scala.Predef.Set.empty[Nothing].head)(scala.reflect.`package`.materializeClassTag[NoSuchElementException](), source.this.Position.here))(source.this.Position.here)
},SetSpec.this.convertToStringMustWrapperForVerb('An empty Set')(source.this.Position.here),convertToStringMustWrapperForVerb,List(An empty Set)) must have size 0.launch.
Any help/workarounds appreciated.
Thanks,
Devendra
Reply all
Reply to author
Forward
0 new messages