forked from relaypro-open/YarnRunner-Python
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request relaypro-open#9 from josefalanga/variables-declara…
…tion Support Variable Declaration (set initial values)
- Loading branch information
Showing
7 changed files
with
85 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
id,node,lineNumber,tags |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
id,text,file,node,lineNumber | ||
line:C:\jose\YarnRunner-Python\examples\yarn2\declarations.yarn-Start-0,The value of test bool is {0},C:\jose\YarnRunner-Python\examples\yarn2\declarations.yarn,Start,10 | ||
line:C:\jose\YarnRunner-Python\examples\yarn2\declarations.yarn-Start-1,The value of test number is {0},C:\jose\YarnRunner-Python\examples\yarn2\declarations.yarn,Start,11 | ||
line:C:\jose\YarnRunner-Python\examples\yarn2\declarations.yarn-Start-2,"The value of test string is ""{0}""",C:\jose\YarnRunner-Python\examples\yarn2\declarations.yarn,Start,12 | ||
line:C:\jose\YarnRunner-Python\examples\yarn2\declarations.yarn-Start-3,The value of test bool is {0},C:\jose\YarnRunner-Python\examples\yarn2\declarations.yarn,Start,13 | ||
line:C:\jose\YarnRunner-Python\examples\yarn2\declarations.yarn-Start-4,The value of test number is {0},C:\jose\YarnRunner-Python\examples\yarn2\declarations.yarn,Start,14 | ||
line:C:\jose\YarnRunner-Python\examples\yarn2\declarations.yarn-Start-5,"The value of test string is ""{0}""",C:\jose\YarnRunner-Python\examples\yarn2\declarations.yarn,Start,15 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
title: Start | ||
--- | ||
<<declare $testString = "initial value">> | ||
<<declare $testNum = 1234556>> | ||
<<declare $testBool = true>> | ||
<<declare $testStringDefault = "">> | ||
<<declare $testNumDefault = 0>> | ||
<<declare $testBoolDefault = false>> | ||
|
||
The value of test bool is {$testBool} | ||
The value of test number is {$testNum} | ||
The value of test string is "{$testString}" | ||
The value of test bool is {$testBoolDefault} | ||
The value of test number is {$testNumDefault} | ||
The value of test string is "{$testStringDefault}" | ||
=== |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
import os | ||
from .context import YarnRunner | ||
|
||
compiled_yarn = open(os.path.join(os.path.dirname( | ||
__file__), '../examples/yarn2/declarations.yarnc'), 'rb') | ||
names_csv = open(os.path.join(os.path.dirname( | ||
__file__), '../examples/yarn2/declarations.csv'), 'r') | ||
|
||
runner = YarnRunner(compiled_yarn, names_csv) | ||
|
||
|
||
def test_variables1(): | ||
# variables are stored | ||
assert runner.variables["$testBool"] is True | ||
assert runner.variables["$testNum"] == 1234556 | ||
assert runner.variables["$testString"] == "initial value" | ||
|
||
# the values get to the output without exceptions | ||
assert runner.get_line() == 'The value of test bool is True' | ||
assert runner.get_line() == 'The value of test number is 1234556.0' | ||
assert runner.get_line() == 'The value of test string is "initial value"' | ||
assert runner.get_line() == 'The value of test bool is False' | ||
assert runner.get_line() == 'The value of test number is 0.0' | ||
assert runner.get_line() == 'The value of test string is ""' | ||
|
||
assert runner.has_line() is False |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.