diff options
author | Homu <homu@barosl.com> | 2016-08-26 14:18:04 +0900 |
---|---|---|
committer | Homu <homu@barosl.com> | 2016-08-26 14:18:04 +0900 |
commit | a4a5f1c53156e85c597e9938f08e874930199957 (patch) | |
tree | b89518c7790a813ad4b9d22f39b11a2bdfcba7ba | |
parent | c71f43fbcb9ee25bc4466137cc29545cda1375e2 (diff) | |
parent | 35dd0aad5aa665da9da9e2065a5ec5911b9e403a (diff) | |
download | bundler-a4a5f1c53156e85c597e9938f08e874930199957.tar.gz |
Auto merge of #4491 - bundler:seg-exec-file--zsh, r=indirect
[Exec] Add specs for $0 and __FILE__ when loaded
Tests for #4488
-rw-r--r-- | spec/commands/exec_spec.rb | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/spec/commands/exec_spec.rb b/spec/commands/exec_spec.rb index e1b94d80d5..42afbd24ba 100644 --- a/spec/commands/exec_spec.rb +++ b/spec/commands/exec_spec.rb @@ -564,6 +564,42 @@ describe "bundle exec" do it_behaves_like "it runs" end + context "regarding $0 and __FILE__" do + let(:executable) { super() + <<-'RUBY' } + + puts "$0: #{$0.inspect}" + puts "__FILE__: #{__FILE__.inspect}" + RUBY + + let(:expected) { super() + <<-EOS.chomp } + +$0: #{path.to_s.inspect} +__FILE__: #{path.to_s.inspect} + EOS + + it_behaves_like "it runs" + + context "when the path is relative" do + let(:path) { super().relative_path_from(bundled_app) } + + if LessThanProc.with(RUBY_VERSION).call("1.9") + pending "relative paths have ./ __FILE__" + else + it_behaves_like "it runs" + end + end + + context "when the path is relative with a leading ./" do + let(:path) { Pathname.new("./#{super().relative_path_from(Pathname.pwd)}") } + + if LessThanProc.with(RUBY_VERSION).call("< 1.9") + pending "relative paths with ./ have absolute __FILE__" + else + it_behaves_like "it runs" + end + end + end + context "signals being trapped by bundler" do let(:executable) { strip_whitespace <<-RUBY } #{shebang} |