# examples/variable_substitution.chor
feature "Variable Substitution"
var FILENAME = "my_test_output.txt"
var GREETING = "Hello from a defined variable!"
actors: Terminal, FileSystem
scenario "Using file-defined variables" {
test UseFileVars "it uses variables defined in the test file" {
given:
FileSystem delete_file "${FILENAME}"
when:
Terminal run "echo '${GREETING}' > ${FILENAME}"
then:
Terminal last_command succeeded
FileSystem file_exists "${FILENAME}"
FileSystem file_contains "${FILENAME}" with_content "${GREETING}"
}
after {
# This block runs after the 'UseFileVars' test, ensuring cleanup.
FileSystem delete_file "${FILENAME}"
}
}