-
Notifications
You must be signed in to change notification settings - Fork 16
Document use of Validation section #100
Comments
To answer your aside question: I've put all examples here. We can change it later, but for now it works. https://github.com/Azure/simdem/tree/simdem2/examples Regarding implementing validation:
|
Ah, ok. I was thinking that Validation is a section that validates the entire document completed successfully. Let me mull over this change as I will probably need to pass the "mode" variable into the parser so that it only treats "# Validation" special if it's a prerequisite. |
Correction: I will need to pass "is_prerequisite" into the parser, so that it knows if it should handle the validation section. Otherwise, it should just treat it as a regular body section. |
@rgardler Can you validate it works according to spec? I've added the following commit to the simdem2 branch which should fix the issue. |
Confirmed... working as expected, thanks. Leaving this open (but dropping priority) as a reminder for me to move the example into docs. |
Validation sections are both a normal part of a document and a way to test if a prerequisite is run. This issue is about their use as a normal part of a document. In this mode the validation section should be run. Consider the example below which should output and/or test the value of UNIQUE_FILENAME when run in any mode.
ASIDE: I've written this example as both documentation and test script... where should it live?
How to use Environment Variables to Configure SimDem Scripts
It can be convenient to have a SimDem script that creates a number of environment variables for use in other scripts. This script can then be used as a prerequisite to ensure that you have a consistent environment on each execution. To set an environment variable use a command like the following:
MY_VARIABLE="My value"
You can use bash commands to create unique strings too:
UNIQUE_FILENAME=my_filename_$(date +%Y-%m-%d-%H)
If you want to avoid overwriting values provided by the SimDem user, you can easily do so with a value check:
Validation
A validation section is useful in two ways. It can be used to ensure we output the final results when executing in a tutorial/demo environment and it can be used to test whether a prerequisite file needs to be run. For example:
Results:
The text was updated successfully, but these errors were encountered: