On Monday, July 25, 2016 at 9:18:10 AM UTC-6, [email protected] wrote:
> On Monday, July 25, 2016 at 9:08:34 AM UTC-6, [email protected] wrote:
> > I'm running some tests on extension code using scalatest_2.9.2-1.8.jar and 
> > org.nlogo.headless.TestExtensions. I'm getting the following exception that 
> > I can't seem to track down in the source code (version mismatch, perhaps). 
> > I think the test codes uses 5.0.5.
> > 
> > The test is calling an instantiator and comparing it with it's dump string. 
> > If the strings don't match, it fails with that message. If the strings 
> > match (i.e. it passes the test) it fails with the following stack below. 
> > Since it passed the string compare, and I'm not doing any importing (that I 
> > know of) I really don't get the exception message.
> > 
> >   org.nlogo.api.CompilerException: Can only have constant agents and 
> > agentsets if importing.
> >   at 
> > org.nlogo.compiler.CompilerExceptionThrowers$.exception(CompilerExceptionThrowers.scala:26)
> >   at 
> > org.nlogo.compiler.CompilerExceptionThrowers$.cAssert(CompilerExceptionThrowers.scala:18)
> >   at 
> > org.nlogo.compiler.ConstantParser.parseConstantLiteral(ConstantParser.scala:138)
> >   at 
> > org.nlogo.compiler.ConstantParser.readConstantPrefix(ConstantParser.scala:95)
> >   at 
> > org.nlogo.compiler.ConstantParser.getConstantValue(ConstantParser.scala:66)
> >   at 
> > org.nlogo.compiler.Compiler$$anonfun$readFromString$1.apply(Compiler.scala:92)
> >   at scala.Either$RightProjection.getOrElse(Either.scala:479)
> >   at org.nlogo.compiler.Compiler$.readFromString(Compiler.scala:91)
> >   at 
> > org.nlogo.headless.AbstractTestLanguage.testReporter(AbstractTestLanguage.scala:69)
> >   at 
> > org.nlogo.headless.LanguageTest$Tester$1$$anonfun$8.apply(TestLanguage.scala:106)
> 
> UPDATE: Is it because although ExtensionObject doesn't require that 
> readExtensionObject be implemented, the test deserializer calls it and the 
> default implementation makes bad things happen?

RESOLVED: Yes, readExtensionObject has to be implemented (in the extension 
ClassManager, in this case), and the object-instantiating reporter has to be 
called in the test script with

  O> set glob extension:reporter
  (word glob) => "{{extension: }}"

and life is groovy all over the place.

-- 
You received this message because you are subscribed to the Google Groups 
"netlogo-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to