Commit cb3a5443 authored by Ask Hjorth Larsen's avatar Ask Hjorth Larsen
Browse files

generate scala test code by globbing among tests (borrowed from gulp). Also...

generate scala test code by globbing among tests (borrowed from gulp).  Also commit generated test code
parent 42e6793a
#!/usr/bin/env python
from __future__ import print_function
import os
from glob import glob
scala_imports = """package eu.nomad_lab.parsers
import eu.nomad_lab.{ parsers, DefaultPythonInterpreter }
import org.scalacheck.Properties
import org.specs2.mutable.Specification
import org.{ json4s => jn }
test_template = """\
"test %(name)s " >> {
"test with json-events" >> {
ParserRun.parse(MolcasParser, "parsers/molcas/test/examples/test/%(name)s", "json-events") must_== ParseResult.ParseSuccess
"test with json" >> {
ParserRun.parse(MolcasParser, "parsers/molcas/test/examples/test/%(name)s", "json") must_== ParseResult.ParseSuccess
fd = open('out.scala', 'w')
print('object MolcasParserSpec extends Specification {', file=fd)
print(' "MolcasParserTest" >> {', file=fd)
fnames = glob('test/test???.input.out')
for fname in fnames:
fname = os.path.basename(fname)
print(test_template % dict(name=fname), file=fd)
print(' }', file=fd)
print('}', file=fd)
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment