Skip to content

Commit

Permalink
Whoops, fixed bug with variables test. Now can release 0.2.1.
Browse files Browse the repository at this point in the history
  • Loading branch information
weaversam8 committed Jan 4, 2022
1 parent 2e5c1cc commit f9c1cae
Show file tree
Hide file tree
Showing 5 changed files with 30 additions and 11 deletions.
1 change: 1 addition & 0 deletions examples/yarn2/variables.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
id,text,file,node,lineNumber
6 changes: 6 additions & 0 deletions examples/yarn2/variables.yarn
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
title: Start
---
<<set $value_string to "string">>
<<set $value_float to 1.25>>
<<set $value_bool to true>>
===
Binary file added examples/yarn2/variables.yarnc
Binary file not shown.
33 changes: 22 additions & 11 deletions tests/test_variables.py
Original file line number Diff line number Diff line change
@@ -1,20 +1,31 @@
import os
from .context import YarnRunner

compiled_yarn_f = open(os.path.join(os.path.dirname(
compiled_yarn_f1 = open(os.path.join(os.path.dirname(
__file__), '../examples/yarn1/variables.yarnc'), 'rb')
names_csv_f = open(os.path.join(os.path.dirname(
names_csv_f1 = open(os.path.join(os.path.dirname(
__file__), '../examples/yarn1/variables.csv'), 'r')
compiled_yarn_f2 = open(os.path.join(os.path.dirname(
__file__), '../examples/yarn2/variables.yarnc'), 'rb')
names_csv_f2 = open(os.path.join(os.path.dirname(
__file__), '../examples/yarn2/variables.csv'), 'r')

runner = YarnRunner(compiled_yarn_f, names_csv_f)
runner1 = YarnRunner(compiled_yarn_f1, names_csv_f1)
runner2 = YarnRunner(compiled_yarn_f2, names_csv_f2)


def test_variables():
assert not runner.has_line()
assert runner.finished
assert runner.variables["$value_string"] == "string"
assert runner.variables["$value_float"] == 1.25
assert runner.variables["$value_bool"] == True
assert runner.variables["$value_null"] is None
def test_variables1():
assert not runner1.has_line()
assert runner1.finished
assert runner1.variables["$value_string"] == "string"
assert runner1.variables["$value_float"] == 1.25
assert runner1.variables["$value_bool"] == True
assert runner1.variables["$value_null"] is None

# TODO, the variables.yarnc wouldn't compile under YSC 2.0.1-a2eff4c

def test_variables2():
assert not runner2.has_line()
assert runner2.finished
assert runner2.variables["$value_string"] == "string"
assert runner2.variables["$value_float"] == 1.25
assert runner2.variables["$value_bool"] == True
1 change: 1 addition & 0 deletions variables-metadata.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
id,node,lineNumber,tags

0 comments on commit f9c1cae

Please sign in to comment.