forked from NREL/OpenStudio
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adding tests, all pass except native gem on windows
- Loading branch information
Showing
12 changed files
with
206 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,7 @@ | ||
.idea | ||
.ruby-version | ||
.bundle | ||
test_gems | ||
test_fails.txt | ||
/build/ | ||
/build_debug/ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
source 'http://rubygems.org' | ||
|
||
gem 'openstudio-standards', '0.2.0' | ||
gem 'tilt', '2.0.8' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
require 'rubygems' | ||
|
||
def local_gems | ||
Gem::Specification.sort_by{ |g| [g.name.downcase, g.version] }.group_by{ |g| g.name } | ||
end | ||
|
||
# list installed gems | ||
puts local_gems.map{ |name, specs| | ||
[name, specs.map{ |spec| spec.version.to_s }.join(',')].join(' ') | ||
} | ||
|
||
# test a simple gem | ||
require 'tilt' | ||
puts Tilt::VERSION | ||
raise "Tilt version does not match" unless Tilt::VERSION == '2.0.8' | ||
|
||
# test a more complex / larger gem, that should override the existing version installed | ||
require 'openstudio' | ||
require 'openstudio-standards' | ||
puts OpenstudioStandards::VERSION | ||
raise "OpenStudio Standards version does not match" unless OpenstudioStandards::VERSION == '0.2.0' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
source 'http://rubygems.org' | ||
|
||
gem 'xml-simple' | ||
gem 'openstudio-standards', github: 'nrel/openstudio-standards', branch: 'ambient-loop' | ||
gem 'tilt', github: 'rtomayko/tilt', ref: 'abe77eaf1b5f8da0a7e46135f' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
require 'rubygems' | ||
|
||
def local_gems | ||
Gem::Specification.sort_by{ |g| [g.name.downcase, g.version] }.group_by{ |g| g.name } | ||
end | ||
|
||
# list installed gems | ||
puts local_gems.map{ |name, specs| | ||
[name, specs.map{ |spec| spec.version.to_s }.join(',')].join(' ') | ||
} | ||
|
||
# test a github checkout gem | ||
require 'openstudio' | ||
require 'openstudio-standards' | ||
puts OpenstudioStandards::VERSION | ||
raise "OpenStudio Standards version does not match" unless OpenstudioStandards::VERSION.to_s == '0.5.0-ambient' | ||
|
||
require 'tilt' | ||
puts Tilt::VERSION | ||
raise "Tilt version does not match" unless Tilt::VERSION == '2.0.8' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
source 'http://rubygems.org' | ||
|
||
gem 'ffi', '1.9.25' | ||
gem 'rubyXL', '3.3.29' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
require 'rubygems' | ||
|
||
def local_gems | ||
Gem::Specification.sort_by{ |g| [g.name.downcase, g.version] }.group_by{ |g| g.name } | ||
end | ||
|
||
# list installed gems | ||
puts local_gems.map{ |name, specs| | ||
[name, specs.map{ |spec| spec.version.to_s }.join(',')].join(' ') | ||
} | ||
# test a gem that required native extensions | ||
require 'ffi' | ||
puts FFI::VERSION | ||
raise "FFI version does not match" unless FFI::VERSION == '1.9.25' | ||
|
||
require 'rubyXL' | ||
puts RubyXL::VERSION | ||
raise "RubyXL version does not match" unless RubyXL::VERSION == '3.3.29' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
source 'http://rubygems.org' | ||
|
||
gem 'openstudio-standards', '0.2.2' | ||
gem 'tilt', '2.0.8' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
require 'rubygems' | ||
|
||
def local_gems | ||
Gem::Specification.sort_by{ |g| [g.name.downcase, g.version] }.group_by{ |g| g.name } | ||
end | ||
|
||
# list installed gems | ||
puts local_gems.map{ |name, specs| | ||
[name, specs.map{ |spec| spec.version.to_s }.join(',')].join(' ') | ||
} | ||
|
||
# test a simple gem | ||
require 'tilt' | ||
puts Tilt::VERSION | ||
raise "Tilt version does not match" unless Tilt::VERSION == '2.0.8' | ||
|
||
# test a more complex / larger gem, that should override the existing version installed | ||
require 'openstudio' | ||
require 'openstudio-standards' | ||
puts OpenstudioStandards::VERSION | ||
raise "OpenStudio Standards version does not match" unless OpenstudioStandards::VERSION == '0.2.0' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
require 'rubygems' | ||
|
||
def local_gems | ||
Gem::Specification.sort_by{ |g| [g.name.downcase, g.version] }.group_by{ |g| g.name } | ||
end | ||
|
||
# list installed gems | ||
puts local_gems.map{ |name, specs| | ||
[name, specs.map{ |spec| spec.version.to_s }.join(',')].join(' ') | ||
} | ||
|
||
# test a more complex / larger gem, that should override the existing version installed | ||
require 'openstudio' | ||
require 'openstudio-standards' | ||
puts OpenstudioStandards::VERSION |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,89 @@ | ||
require 'minitest/autorun' | ||
require 'openstudio' | ||
|
||
# test bundle capability in CLI | ||
# currently CLI cannot do bundle install, rely on system bundle for that | ||
class Bundle_Test < Minitest::Test | ||
|
||
def rm_if_exist(p) | ||
if File.exist?(p) | ||
FileUtils.rm_rf(p) | ||
end | ||
end | ||
|
||
def test_bundle | ||
original_dir = Dir.pwd | ||
Dir.chdir(File.join(File.dirname(__FILE__), 'bundle')) | ||
|
||
rm_if_exist('Gemfile.lock') | ||
rm_if_exist('./test_gems') | ||
rm_if_exist('./bundle') | ||
|
||
assert(system('bundle install --path ./test_gems')) | ||
assert(system('bundle lock --add_platform ruby')) | ||
assert(system("'#{OpenStudio::getOpenStudioCLI}' --bundle Gemfile --verbose test.rb")) | ||
|
||
ensure | ||
Dir.chdir(original_dir) | ||
end | ||
|
||
def test_bundle_git | ||
original_dir = Dir.pwd | ||
Dir.chdir(File.join(File.dirname(__FILE__), 'bundle_git')) | ||
|
||
rm_if_exist('Gemfile.lock') | ||
rm_if_exist('./test_gems') | ||
rm_if_exist('./bundle') | ||
|
||
assert(system('bundle install --path ./test_gems')) | ||
assert(system('bundle lock --add_platform ruby')) | ||
assert(system("'#{OpenStudio::getOpenStudioCLI}' --bundle Gemfile --verbose test.rb")) | ||
|
||
ensure | ||
Dir.chdir(original_dir) | ||
end | ||
|
||
def test_bundle_native | ||
original_dir = Dir.pwd | ||
Dir.chdir(File.join(File.dirname(__FILE__), 'bundle_native')) | ||
|
||
rm_if_exist('Gemfile.lock') | ||
rm_if_exist('./test_gems') | ||
rm_if_exist('./bundle') | ||
|
||
assert(system('bundle install --path ./test_gems')) | ||
assert(system('bundle lock --add_platform ruby')) | ||
assert(system('bundle lock --add_platform mswin')) | ||
assert(system("'#{OpenStudio::getOpenStudioCLI}' --bundle Gemfile --verbose test.rb")) | ||
|
||
ensure | ||
Dir.chdir(original_dir) | ||
end | ||
|
||
def test_bundle_no_install | ||
original_dir = Dir.pwd | ||
Dir.chdir(File.join(File.dirname(__FILE__), 'bundle_no_install')) | ||
|
||
rm_if_exist('Gemfile.lock') | ||
rm_if_exist('./test_gems') | ||
rm_if_exist('./bundle') | ||
|
||
#assert(system('bundle install --path ./test_gems')) | ||
#assert(system('bundle lock --add_platform ruby')) | ||
assert_equal(system("'#{OpenStudio::getOpenStudioCLI}' --bundle Gemfile --verbose test.rb"), false) | ||
|
||
ensure | ||
Dir.chdir(original_dir) | ||
end | ||
|
||
def test_no_bundle | ||
original_dir = Dir.pwd | ||
Dir.chdir(File.join(File.dirname(__FILE__), 'no_bundle')) | ||
|
||
assert(system("'#{OpenStudio::getOpenStudioCLI}' --verbose test.rb")) | ||
|
||
ensure | ||
Dir.chdir(original_dir) | ||
end | ||
|
||
end |