Stop duping options when duping the build object
The options collection cannot be mutated from the build object, so it can be shared among copies safely.
This commit is contained in:
parent
618bb9b413
commit
f0b75b2869
@ -7,7 +7,6 @@ class BuildOptions
|
|||||||
|
|
||||||
attr_accessor :args
|
attr_accessor :args
|
||||||
attr_accessor :universal
|
attr_accessor :universal
|
||||||
attr_reader :options
|
|
||||||
|
|
||||||
def initialize(args, options)
|
def initialize(args, options)
|
||||||
@args = Options.coerce(args)
|
@args = Options.coerce(args)
|
||||||
@ -16,7 +15,6 @@ class BuildOptions
|
|||||||
|
|
||||||
def initialize_copy(other)
|
def initialize_copy(other)
|
||||||
super
|
super
|
||||||
@options = other.options.dup
|
|
||||||
@args = other.args.dup
|
@args = other.args.dup
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -37,12 +37,6 @@ class BuildOptionsTests < Homebrew::TestCase
|
|||||||
assert_includes @build.unused_options, "--without-baz"
|
assert_includes @build.unused_options, "--without-baz"
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_copies_do_not_share_underlying_options
|
|
||||||
orig = BuildOptions.new [], Options.new
|
|
||||||
copy = orig.dup
|
|
||||||
refute_same orig.options, copy.options
|
|
||||||
end
|
|
||||||
|
|
||||||
def test_copies_do_not_share_underlying_args
|
def test_copies_do_not_share_underlying_args
|
||||||
orig = BuildOptions.new [], Options.new
|
orig = BuildOptions.new [], Options.new
|
||||||
copy = orig.dup
|
copy = orig.dup
|
||||||
|
Loading…
x
Reference in New Issue
Block a user