Skip to content

Commit

Permalink
Add example as executable test.
Browse files Browse the repository at this point in the history
  • Loading branch information
jonifreeman committed Jul 7, 2009
1 parent 04dc282 commit 248db0f
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 0 deletions.
Binary file added lib/scalatest-0.9.5.jar
Binary file not shown.
32 changes: 32 additions & 0 deletions src/test/scala/literaljson/examples.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
package literaljson

import org.scalatest._

class ExampleSuite extends FunSuite {
import JsonAST._
import JsonDSL._
import JsonParser._

test("Lotto example") {
val lottoAST = parse(lotto)
val renderedLotto = compact(render(lottoAST))
assert(lottoAST == parse(renderedLotto))
}

val lotto = """
{
"lotto":{
"lotto-id":5,
"winning-numbers":[2,45,34,23,7,5,3],
"winners":[{
"winner-id":23,
"numbers":[2,45,34,23,3,5]
},{
"winner-id":54,
"numbers":[52,3,12,11,18,22]
}]
}
}
"""
}

0 comments on commit 248db0f

Please sign in to comment.