Skip to content

Commit

Permalink
Add another end-to-end serialization test
Browse files Browse the repository at this point in the history
  • Loading branch information
tekknolagi committed Nov 22, 2023
1 parent 174bda4 commit 00d032e
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions scrapscript.py
Original file line number Diff line number Diff line change
Expand Up @@ -1926,6 +1926,13 @@ def test_serialize_bool(self) -> None:
obj = Bool(True)
self.assertEqual(serialize(obj), b"d4:type4:Bool5:valuei1ee")

def test_serialize_function(self) -> None:
obj = Function(Var("x"), Binop(BinopKind.ADD, Int(1), Var("x")))
self.assertEqual(
serialize(obj),
b"d3:argd4:name1:x4:type3:Vare4:bodyd4:leftd4:type3:Int5:valuei1ee2:op3:ADD5:rightd4:name1:x4:type3:Vare4:type5:Binope4:type8:Functione",
)


def eval_command(args: argparse.Namespace) -> None:
if args.debug:
Expand Down

0 comments on commit 00d032e

Please sign in to comment.