Skip to content
This repository was archived by the owner on Mar 8, 2020. It is now read-only.

Commit c4c15bb

Browse files
committed
Test decode + encode only for binary format
It is the only format we can assure it is invertible Signed-off-by: ncordon <[email protected]>
1 parent 966f065 commit c4c15bb

File tree

2 files changed

+10
-11
lines changed

2 files changed

+10
-11
lines changed

src/main/scala/org/bblfsh/client/v2/package.scala

+2-2
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ package object v2 {
2424
case UastBinary.toInt => UastBinary
2525
case UastYaml.toInt => UastYaml
2626
case _ =>
27-
println("warning: not valid numeric format, using UastBinary")
27+
System.err.println("warning: not valid numeric format, using UastBinary")
2828
UastBinary
2929
}
3030
}
@@ -46,7 +46,7 @@ package object v2 {
4646
case ChildrenOrder.toInt => ChildrenOrder
4747
case PositionOrder.toInt => PositionOrder
4848
case _ =>
49-
println("warning: not valid numeric order, using AnyOrder")
49+
System.err.println("warning: not valid numeric order, using AnyOrder")
5050
AnyOrder
5151
}
5252
}

src/test/scala/org/bblfsh/client/v2/BblfshClientParseTest.scala

+8-9
Original file line numberDiff line numberDiff line change
@@ -80,15 +80,14 @@ class BblfshClientParseTest extends BblfshClientBaseTest {
8080
default shouldEqual binary
8181
}
8282

83-
"BblfshClient.decode" should "be the inverse for ContextExt.encode" in {
84-
for (fmt <- Seq(UastBinary, UastYaml)) {
85-
val ctx: ContextExt = resp.uast.decode()
86-
val tree = ctx.root()
87-
val bytes = ctx.encode(tree, fmt)
88-
val decoded = BblfshClient.decode(bytes, fmt)
89-
90-
ctx.root().load() shouldEqual decoded.root().load()
91-
}
83+
"BblfshClient.decode" should "be the inverse for ContextExt.encode for binary format" in {
84+
val fmt = UastBinary
85+
val ctx: ContextExt = resp.uast.decode()
86+
val tree = ctx.root()
87+
val bytes = ctx.encode(tree, fmt)
88+
val decoded = BblfshClient.decode(bytes, fmt)
89+
90+
ctx.root().load() shouldEqual decoded.root().load()
9291
}
9392

9493
"BblfshClient.decode with invalid number" should "use binary format" in {

0 commit comments

Comments
 (0)