File tree Expand file tree Collapse file tree 2 files changed +61
-1
lines changed Expand file tree Collapse file tree 2 files changed +61
-1
lines changed Original file line number Diff line number Diff line change @@ -272,7 +272,7 @@ def parse_spec(line)
272272 end
273273
274274 def parse_platform ( line )
275- @platforms << Gem ::Platform . new ( $1) if line =~ /^ (.*)$/
275+ @platforms << Gem ::Platform . new ( $1. strip ) if line =~ /^ (.*)$/
276276 end
277277
278278 def parse_bundled_with ( line )
Original file line number Diff line number Diff line change 19901990 L
19911991 end
19921992 end
1993+
1994+ context "when lockfile has incorrectly indented platforms" do
1995+ before do
1996+ build_repo4 do
1997+ build_gem "ffi" , "1.1.0" do |s |
1998+ s . platform = "x86_64-linux"
1999+ end
2000+
2001+ build_gem "ffi" , "1.1.0" do |s |
2002+ s . platform = "arm64-darwin"
2003+ end
2004+ end
2005+
2006+ gemfile <<~G
2007+ source "https://gem.repo4"
2008+
2009+ gem "ffi"
2010+ G
2011+
2012+ lockfile <<~L
2013+ GEM
2014+ remote: https://gem.repo4/
2015+ specs:
2016+ ffi (1.1.0-arm64-darwin)
2017+
2018+ PLATFORMS
2019+ arm64-darwin
2020+
2021+ DEPENDENCIES
2022+ ffi
2023+
2024+ BUNDLED WITH
2025+ #{ Bundler ::VERSION }
2026+ L
2027+ end
2028+
2029+ it "does not remove any gems" do
2030+ simulate_platform "x86_64-linux" do
2031+ bundle "lock --update"
2032+ end
2033+
2034+ expect ( lockfile ) . to eq <<~L
2035+ GEM
2036+ remote: https://gem.repo4/
2037+ specs:
2038+ ffi (1.1.0-arm64-darwin)
2039+ ffi (1.1.0-x86_64-linux)
2040+
2041+ PLATFORMS
2042+ arm64-darwin
2043+ x86_64-linux
2044+
2045+ DEPENDENCIES
2046+ ffi
2047+
2048+ BUNDLED WITH
2049+ #{ Bundler ::VERSION }
2050+ L
2051+ end
2052+ end
19932053end
You can’t perform that action at this time.
0 commit comments