From 615278f3365087e436ee5ea13e0d15bd60718038 Mon Sep 17 00:00:00 2001 From: "A. Wilcox" Date: Tue, 10 Oct 2023 23:30:18 -0500 Subject: hscript: Allow multiple inheritance This allows a HorizonScript to inherit from multiple files. Files are parsed in a system-defined, unspecified order, but all scripts of a given depth are guaranteed to be parsed before the next depth. --- tests/spec/validator_spec.rb | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) (limited to 'tests/spec/validator_spec.rb') diff --git a/tests/spec/validator_spec.rb b/tests/spec/validator_spec.rb index 282d7ca..3a491a0 100644 --- a/tests/spec/validator_spec.rb +++ b/tests/spec/validator_spec.rb @@ -80,6 +80,35 @@ RSpec.describe 'HorizonScript validation', :type => :aruba do run_validate expect(last_command_started).to have_output(/error: .*length/) end + context "inheritance" do + it "supports basic single inheritance" do + use_fixture '0232-inherit-basic.installfile' + run_validate + expect(last_command_started).to have_output(PARSER_SUCCESS) + expect(last_command_started).to have_output(VALIDATOR_SUCCESS) + end + it "requires inherited files to exist" do + use_fixture '0233-inherit-missing.installfile' + run_validate + expect(last_command_started).to have_output(/error: .*non-existent/) + end + it "doesn't get stuck in a loop" do + use_fixture '0264-inherit-test-loop.installfile' + run_validate + expect(last_command_started).to have_output(/error: .*already inherited/) + end + it "supports relative paths" do + use_fixture '0236-inherit-relative.installfile' + run_validate + expect(last_command_started).to have_output(PARSER_SUCCESS) + expect(last_command_started).to have_output(VALIDATOR_SUCCESS) + end + it "still knows incomplete files are incomplete" do + use_fixture '0237-inherit-incomplete.installfile' + run_validate + expect(last_command_started).to have_output(/error: expected/) + end + end context "required keys" do # Runner.Validate.Required. # Runner.Validate.network. -- cgit v1.2.3-60-g2f50