Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
P
parser-gulp
Manage
Activity
Members
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Model registry
Analyze
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
This is an archived project. Repository and other project resources are read-only.
Show more breadcrumbs
nomad-lab
parser-gulp
Commits
2f5e6f54
Commit
2f5e6f54
authored
8 years ago
by
Ask Hjorth Larsen
Browse files
Options
Downloads
Patches
Plain Diff
use glob to generate parserspec file
parent
ef03d339
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
2
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
parser/parser-gulp/generate_scala_testcode.py
+39
-0
39 additions, 0 deletions
parser/parser-gulp/generate_scala_testcode.py
src/test/scala/eu/nomad_lab/parsers/GulpParserSpec.scala
+418
-2
418 additions, 2 deletions
src/test/scala/eu/nomad_lab/parsers/GulpParserSpec.scala
with
457 additions
and
2 deletions
parser/parser-gulp/generate_scala_testcode.py
0 → 100755
+
39
−
0
View file @
2f5e6f54
#!/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(GulpParser,
"
parsers/gulp/test/examples/outputs/%(name)s
"
,
"
json-events
"
) must_== ParseResult.ParseSuccess
}
"
test with json
"
>> {
ParserRun.parse(GulpParser,
"
parsers/gulp/test/examples/outputs/%(name)s
"
,
"
json
"
) must_== ParseResult.ParseSuccess
}
}
"""
fd
=
open
(
'
out.scala
'
,
'
w
'
)
fd
.
write
(
scala_imports
)
print
(
'
object GulpParserSpec extends Specification {
'
,
file
=
fd
)
print
(
'
"
GulpParserTest
"
>> {
'
,
file
=
fd
)
fnames
=
glob
(
'
test/outputs/example*.got
'
)
fnames
.
sort
()
for
fname
in
fnames
:
fname
=
os
.
path
.
basename
(
fname
)
print
(
test_template
%
dict
(
name
=
fname
),
file
=
fd
)
print
(
'
}
'
,
file
=
fd
)
print
(
'
}
'
,
file
=
fd
)
This diff is collapsed.
Click to expand it.
src/test/scala/eu/nomad_lab/parsers/GulpParserSpec.scala
+
418
−
2
View file @
2f5e6f54
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment