From f5a3b448d31ce82fced7f826165b0ea1841ec9a4 Mon Sep 17 00:00:00 2001 From: Josh Holtrop Date: Thu, 15 May 2014 15:54:02 -0400 Subject: [PATCH] test supported construction variable types when cloning --- spec/rscons/environment_spec.rb | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/spec/rscons/environment_spec.rb b/spec/rscons/environment_spec.rb index 8d31263..b7adc3d 100644 --- a/spec/rscons/environment_spec.rb +++ b/spec/rscons/environment_spec.rb @@ -34,6 +34,27 @@ module Rscons env2["CPPPATH"].should == ["path1", "path2"] end + it "supports nil, false, true, String, Symbol, Array, Hash, and Integer variables" do + env = Environment.new + env["nil"] = nil + env["false"] = false + env["true"] = true + env["String"] = "String" + env["Symbol"] = :Symbol + env["Array"] = ["a", "b"] + env["Hash"] = {"a" => "b"} + env["Integer"] = 1234 + env2 = env.clone + expect(env2["nil"]).to be_nil + expect(env2["false"].object_id).to eq(false.object_id) + expect(env2["true"].object_id).to eq(true.object_id) + expect(env2["String"]).to eq("String") + expect(env2["Symbol"]).to eq(:Symbol) + expect(env2["Array"]).to eq(["a", "b"]) + expect(env2["Hash"]).to eq({"a" => "b"}) + expect(env2["Integer"]).to eq(1234) + end + context "when a block is given" do it "yields self and invokes #process()" do env = Environment.new