win32-api 1.5.3-universal-mingw32 → 1.6.0-universal-mingw32
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGES +174 -169
- data/Gemfile +4 -0
- data/Gemfile.lock +24 -0
- data/README +129 -131
- data/Rakefile +185 -182
- data/appveyor.yml +42 -0
- data/ext/win32/api.c +1092 -1092
- data/lib/win32/api.rb +14 -8
- data/lib/win32/ruby21_32/win32/api.so +0 -0
- data/lib/win32/ruby21_64/win32/api.so +0 -0
- data/lib/win32/ruby22_32/win32/api.so +0 -0
- data/lib/win32/ruby22_64/win32/api.so +0 -0
- data/lib/win32/ruby23_32/win32/api.so +0 -0
- data/lib/win32/ruby23_64/win32/api.so +0 -0
- data/lib/win32/ruby2_32/win32/api.so +0 -0
- data/lib/win32/ruby2_64/win32/api.so +0 -0
- data/test/test_win32_api.rb +145 -145
- data/vendor/bundle/ruby/2.2.0/bin/devkit +23 -0
- data/vendor/bundle/ruby/2.2.0/bin/devkit.bat +6 -0
- data/vendor/bundle/ruby/2.2.0/bin/rake +23 -0
- data/vendor/bundle/ruby/2.2.0/bin/rake.bat +6 -0
- data/vendor/bundle/ruby/2.2.0/gems/colorize-0.7.7/CHANGELOG +55 -0
- data/vendor/bundle/ruby/2.2.0/gems/colorize-0.7.7/LICENSE +339 -0
- data/vendor/bundle/ruby/2.2.0/gems/colorize-0.7.7/README.md +73 -0
- data/vendor/bundle/ruby/2.2.0/gems/colorize-0.7.7/Rakefile +8 -0
- data/vendor/bundle/ruby/2.2.0/gems/colorize-0.7.7/colorize.gemspec +35 -0
- data/vendor/bundle/ruby/2.2.0/gems/colorize-0.7.7/lib/colorize.rb +12 -0
- data/vendor/bundle/ruby/2.2.0/gems/colorize-0.7.7/lib/colorize/class_methods.rb +116 -0
- data/vendor/bundle/ruby/2.2.0/gems/colorize-0.7.7/lib/colorize/instance_methods.rb +135 -0
- data/vendor/bundle/ruby/2.2.0/gems/colorize-0.7.7/test/test_colorize.rb +161 -0
- data/vendor/bundle/ruby/2.2.0/gems/devkit-0.1.0/Gemfile +4 -0
- data/vendor/bundle/ruby/2.2.0/gems/devkit-0.1.0/LICENSE.txt +22 -0
- data/vendor/bundle/ruby/2.2.0/gems/devkit-0.1.0/README.md +34 -0
- data/vendor/bundle/ruby/2.2.0/gems/devkit-0.1.0/Rakefile +1 -0
- data/vendor/bundle/ruby/2.2.0/gems/devkit-0.1.0/Rspec-example-matchers.txt +184 -0
- data/vendor/bundle/ruby/2.2.0/gems/devkit-0.1.0/bin/devkit +87 -0
- data/vendor/bundle/ruby/2.2.0/gems/devkit-0.1.0/devkit.gemspec +27 -0
- data/vendor/bundle/ruby/2.2.0/gems/devkit-0.1.0/lib/devkit.rb +18 -0
- data/vendor/bundle/ruby/2.2.0/gems/devkit-0.1.0/lib/devkit/core.rb +53 -0
- data/vendor/bundle/ruby/2.2.0/gems/devkit-0.1.0/lib/devkit/identity.rb +78 -0
- data/vendor/bundle/ruby/2.2.0/gems/devkit-0.1.0/lib/devkit/ssh_identity.rb +53 -0
- data/vendor/bundle/ruby/2.2.0/gems/devkit-0.1.0/lib/devkit/version.rb +3 -0
- data/vendor/bundle/ruby/2.2.0/gems/devkit-0.1.0/spec/devkit/core_spec.rb +46 -0
- data/vendor/bundle/ruby/2.2.0/gems/devkit-0.1.0/spec/devkit/identity_spec.rb +1 -0
- data/vendor/bundle/ruby/2.2.0/gems/devkit-0.1.0/spec/devkit/ssh_identity_spec.rb +1 -0
- data/vendor/bundle/ruby/2.2.0/gems/devkit-0.1.0/spec/devkit_spec.rb +5 -0
- data/vendor/bundle/ruby/2.2.0/gems/devkit-0.1.0/spec/spec_helper.rb +8 -0
- data/vendor/bundle/ruby/2.2.0/gems/highline-1.7.8/AUTHORS +3 -0
- data/vendor/bundle/ruby/2.2.0/gems/highline-1.7.8/COPYING +339 -0
- data/vendor/bundle/ruby/2.2.0/gems/highline-1.7.8/Changelog.md +415 -0
- data/vendor/bundle/ruby/2.2.0/gems/highline-1.7.8/Gemfile +9 -0
- data/vendor/bundle/ruby/2.2.0/gems/highline-1.7.8/INSTALL +59 -0
- data/vendor/bundle/ruby/2.2.0/gems/highline-1.7.8/LICENSE +7 -0
- data/vendor/bundle/ruby/2.2.0/gems/highline-1.7.8/README.rdoc +74 -0
- data/vendor/bundle/ruby/2.2.0/gems/highline-1.7.8/Rakefile +30 -0
- data/vendor/bundle/ruby/2.2.0/gems/highline-1.7.8/TODO +6 -0
- data/vendor/bundle/ruby/2.2.0/gems/highline-1.7.8/examples/ansi_colors.rb +38 -0
- data/vendor/bundle/ruby/2.2.0/gems/highline-1.7.8/examples/asking_for_arrays.rb +18 -0
- data/vendor/bundle/ruby/2.2.0/gems/highline-1.7.8/examples/basic_usage.rb +75 -0
- data/vendor/bundle/ruby/2.2.0/gems/highline-1.7.8/examples/color_scheme.rb +32 -0
- data/vendor/bundle/ruby/2.2.0/gems/highline-1.7.8/examples/get_character.rb +12 -0
- data/vendor/bundle/ruby/2.2.0/gems/highline-1.7.8/examples/limit.rb +12 -0
- data/vendor/bundle/ruby/2.2.0/gems/highline-1.7.8/examples/menus.rb +65 -0
- data/vendor/bundle/ruby/2.2.0/gems/highline-1.7.8/examples/overwrite.rb +19 -0
- data/vendor/bundle/ruby/2.2.0/gems/highline-1.7.8/examples/page_and_wrap.rb +322 -0
- data/vendor/bundle/ruby/2.2.0/gems/highline-1.7.8/examples/password.rb +7 -0
- data/vendor/bundle/ruby/2.2.0/gems/highline-1.7.8/examples/repeat_entry.rb +21 -0
- data/vendor/bundle/ruby/2.2.0/gems/highline-1.7.8/examples/trapping_eof.rb +22 -0
- data/vendor/bundle/ruby/2.2.0/gems/highline-1.7.8/examples/using_readline.rb +17 -0
- data/vendor/bundle/ruby/2.2.0/gems/highline-1.7.8/highline.gemspec +37 -0
- data/vendor/bundle/ruby/2.2.0/gems/highline-1.7.8/lib/highline.rb +1048 -0
- data/vendor/bundle/ruby/2.2.0/gems/highline-1.7.8/lib/highline/color_scheme.rb +134 -0
- data/vendor/bundle/ruby/2.2.0/gems/highline-1.7.8/lib/highline/compatibility.rb +16 -0
- data/vendor/bundle/ruby/2.2.0/gems/highline-1.7.8/lib/highline/import.rb +41 -0
- data/vendor/bundle/ruby/2.2.0/gems/highline-1.7.8/lib/highline/menu.rb +381 -0
- data/vendor/bundle/ruby/2.2.0/gems/highline-1.7.8/lib/highline/question.rb +480 -0
- data/vendor/bundle/ruby/2.2.0/gems/highline-1.7.8/lib/highline/simulate.rb +48 -0
- data/vendor/bundle/ruby/2.2.0/gems/highline-1.7.8/lib/highline/style.rb +192 -0
- data/vendor/bundle/ruby/2.2.0/gems/highline-1.7.8/lib/highline/version.rb +4 -0
- data/vendor/bundle/ruby/2.2.0/gems/highline-1.7.8/setup.rb +1360 -0
- data/vendor/bundle/ruby/2.2.0/gems/highline-1.7.8/site/highline.css +65 -0
- data/vendor/bundle/ruby/2.2.0/gems/highline-1.7.8/site/images/logo.png +0 -0
- data/vendor/bundle/ruby/2.2.0/gems/highline-1.7.8/site/index.html +58 -0
- data/vendor/bundle/ruby/2.2.0/gems/highline-1.7.8/test/string_methods.rb +32 -0
- data/vendor/bundle/ruby/2.2.0/gems/highline-1.7.8/test/tc_color_scheme.rb +96 -0
- data/vendor/bundle/ruby/2.2.0/gems/highline-1.7.8/test/tc_highline.rb +1402 -0
- data/vendor/bundle/ruby/2.2.0/gems/highline-1.7.8/test/tc_import.rb +52 -0
- data/vendor/bundle/ruby/2.2.0/gems/highline-1.7.8/test/tc_menu.rb +439 -0
- data/vendor/bundle/ruby/2.2.0/gems/highline-1.7.8/test/tc_simulator.rb +23 -0
- data/vendor/bundle/ruby/2.2.0/gems/highline-1.7.8/test/tc_string_highline.rb +38 -0
- data/vendor/bundle/ruby/2.2.0/gems/highline-1.7.8/test/tc_style.rb +578 -0
- data/vendor/bundle/ruby/2.2.0/gems/power_assert-0.3.0/BSDL +22 -0
- data/vendor/bundle/ruby/2.2.0/gems/power_assert-0.3.0/COPYING +57 -0
- data/vendor/bundle/ruby/2.2.0/gems/power_assert-0.3.0/Gemfile +9 -0
- data/vendor/bundle/ruby/2.2.0/gems/power_assert-0.3.0/LEGAL +4 -0
- data/vendor/bundle/ruby/2.2.0/gems/power_assert-0.3.0/README.rdoc +19 -0
- data/vendor/bundle/ruby/2.2.0/gems/power_assert-0.3.0/Rakefile +16 -0
- data/vendor/bundle/ruby/2.2.0/gems/power_assert-0.3.0/benchmarks/bm_yhpg.rb +59 -0
- data/vendor/bundle/ruby/2.2.0/gems/power_assert-0.3.0/benchmarks/helper.rb +8 -0
- data/vendor/bundle/ruby/2.2.0/gems/power_assert-0.3.0/lib/power_assert.rb +338 -0
- data/vendor/bundle/ruby/2.2.0/gems/power_assert-0.3.0/lib/power_assert/enable_tracepoint_events.rb +82 -0
- data/vendor/bundle/ruby/2.2.0/gems/power_assert-0.3.0/lib/power_assert/version.rb +3 -0
- data/vendor/bundle/ruby/2.2.0/gems/power_assert-0.3.0/power_assert.gemspec +23 -0
- data/vendor/bundle/ruby/2.2.0/gems/power_assert-0.3.0/test/helper.rb +10 -0
- data/vendor/bundle/ruby/2.2.0/gems/power_assert-0.3.0/test/test_power_assert.rb +512 -0
- data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/CONTRIBUTING.rdoc +38 -0
- data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/History.rdoc +719 -0
- data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/MIT-LICENSE +21 -0
- data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/Manifest.txt +154 -0
- data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/README.rdoc +157 -0
- data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/Rakefile +82 -0
- data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/bin/rake +33 -0
- data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/doc/command_line_usage.rdoc +158 -0
- data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/doc/example/Rakefile1 +38 -0
- data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/doc/example/Rakefile2 +35 -0
- data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/doc/example/a.c +6 -0
- data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/doc/example/b.c +6 -0
- data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/doc/example/main.c +11 -0
- data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/doc/glossary.rdoc +42 -0
- data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/doc/jamis.rb +591 -0
- data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/doc/proto_rake.rdoc +127 -0
- data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/doc/rake.1 +141 -0
- data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/doc/rakefile.rdoc +624 -0
- data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/doc/rational.rdoc +151 -0
- data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/doc/release_notes/rake-0.4.14.rdoc +23 -0
- data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/doc/release_notes/rake-0.4.15.rdoc +35 -0
- data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/doc/release_notes/rake-0.5.0.rdoc +53 -0
- data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/doc/release_notes/rake-0.5.3.rdoc +78 -0
- data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/doc/release_notes/rake-0.5.4.rdoc +46 -0
- data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/doc/release_notes/rake-0.6.0.rdoc +141 -0
- data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/doc/release_notes/rake-0.7.0.rdoc +119 -0
- data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/doc/release_notes/rake-0.7.1.rdoc +59 -0
- data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/doc/release_notes/rake-0.7.2.rdoc +121 -0
- data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/doc/release_notes/rake-0.7.3.rdoc +47 -0
- data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/doc/release_notes/rake-0.8.0.rdoc +114 -0
- data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/doc/release_notes/rake-0.8.2.rdoc +165 -0
- data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/doc/release_notes/rake-0.8.3.rdoc +112 -0
- data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/doc/release_notes/rake-0.8.4.rdoc +147 -0
- data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/doc/release_notes/rake-0.8.5.rdoc +53 -0
- data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/doc/release_notes/rake-0.8.6.rdoc +37 -0
- data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/doc/release_notes/rake-0.8.7.rdoc +55 -0
- data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/doc/release_notes/rake-0.9.0.rdoc +112 -0
- data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/doc/release_notes/rake-0.9.1.rdoc +52 -0
- data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/doc/release_notes/rake-0.9.2.2.rdoc +55 -0
- data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/doc/release_notes/rake-0.9.2.rdoc +49 -0
- data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/doc/release_notes/rake-0.9.3.rdoc +102 -0
- data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/doc/release_notes/rake-0.9.4.rdoc +60 -0
- data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/doc/release_notes/rake-0.9.5.rdoc +55 -0
- data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/doc/release_notes/rake-0.9.6.rdoc +64 -0
- data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/doc/release_notes/rake-10.0.0.rdoc +178 -0
- data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/doc/release_notes/rake-10.0.1.rdoc +58 -0
- data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/doc/release_notes/rake-10.0.2.rdoc +53 -0
- data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/doc/release_notes/rake-10.0.3.rdoc +191 -0
- data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/doc/release_notes/rake-10.1.0.rdoc +61 -0
- data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/lib/rake.rb +73 -0
- data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/lib/rake/application.rb +787 -0
- data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/lib/rake/backtrace.rb +23 -0
- data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/lib/rake/clean.rb +76 -0
- data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/lib/rake/cloneable.rb +16 -0
- data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/lib/rake/contrib/compositepublisher.rb +21 -0
- data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/lib/rake/contrib/ftptools.rb +137 -0
- data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/lib/rake/contrib/sshpublisher.rb +60 -0
- data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/lib/rake/cpu_counter.rb +120 -0
- data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/lib/rake/default_loader.rb +14 -0
- data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/lib/rake/dsl_definition.rb +194 -0
- data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/lib/rake/early_time.rb +21 -0
- data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/lib/rake/file_creation_task.rb +24 -0
- data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/lib/rake/file_list.rb +436 -0
- data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/lib/rake/file_task.rb +46 -0
- data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/lib/rake/file_utils.rb +123 -0
- data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/lib/rake/invocation_chain.rb +56 -0
- data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/lib/rake/invocation_exception_mixin.rb +16 -0
- data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/lib/rake/late_time.rb +17 -0
- data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/lib/rake/linked_list.rb +111 -0
- data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/lib/rake/loaders/makefile.rb +53 -0
- data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/lib/rake/multi_task.rb +13 -0
- data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/lib/rake/name_space.rb +38 -0
- data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/lib/rake/packagetask.rb +199 -0
- data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/lib/rake/phony.rb +15 -0
- data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/lib/rake/private_reader.rb +20 -0
- data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/lib/rake/promise.rb +99 -0
- data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/lib/rake/pseudo_status.rb +29 -0
- data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/lib/rake/rake_module.rb +38 -0
- data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/lib/rake/rake_test_loader.rb +22 -0
- data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/lib/rake/rule_recursion_overflow_error.rb +20 -0
- data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/lib/rake/scope.rb +42 -0
- data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/lib/rake/task.rb +391 -0
- data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/lib/rake/task_argument_error.rb +7 -0
- data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/lib/rake/task_arguments.rb +102 -0
- data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/lib/rake/task_manager.rb +316 -0
- data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/lib/rake/tasklib.rb +11 -0
- data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/lib/rake/testtask.rb +204 -0
- data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/lib/rake/thread_history_display.rb +48 -0
- data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/lib/rake/thread_pool.rb +163 -0
- data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/lib/rake/trace_output.rb +22 -0
- data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/lib/rake/version.rb +7 -0
- data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/lib/rake/win32.rb +50 -0
- data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/rakelib/test_times.rake +25 -0
- data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/test/file_creation.rb +34 -0
- data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/test/helper.rb +134 -0
- data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/test/support/rakefile_definitions.rb +476 -0
- data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/test/support/ruby_runner.rb +34 -0
- data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/test/test_private_reader.rb +42 -0
- data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/test/test_rake.rb +40 -0
- data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/test/test_rake_application.rb +659 -0
- data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/test/test_rake_application_options.rb +468 -0
- data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/test/test_rake_backtrace.rb +119 -0
- data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/test/test_rake_clean.rb +61 -0
- data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/test/test_rake_cpu_counter.rb +68 -0
- data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/test/test_rake_definitions.rb +84 -0
- data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/test/test_rake_directory_task.rb +76 -0
- data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/test/test_rake_dsl.rb +40 -0
- data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/test/test_rake_early_time.rb +31 -0
- data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/test/test_rake_file_creation_task.rb +56 -0
- data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/test/test_rake_file_list.rb +687 -0
- data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/test/test_rake_file_list_path_map.rb +15 -0
- data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/test/test_rake_file_task.rb +197 -0
- data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/test/test_rake_file_utils.rb +318 -0
- data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/test/test_rake_ftp_file.rb +74 -0
- data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/test/test_rake_functional.rb +484 -0
- data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/test/test_rake_invocation_chain.rb +64 -0
- data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/test/test_rake_late_time.rb +18 -0
- data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/test/test_rake_linked_list.rb +84 -0
- data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/test/test_rake_makefile_loader.rb +46 -0
- data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/test/test_rake_multi_task.rb +64 -0
- data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/test/test_rake_name_space.rb +57 -0
- data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/test/test_rake_package_task.rb +79 -0
- data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/test/test_rake_path_map.rb +168 -0
- data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/test/test_rake_path_map_explode.rb +34 -0
- data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/test/test_rake_path_map_partial.rb +18 -0
- data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/test/test_rake_pseudo_status.rb +21 -0
- data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/test/test_rake_rake_test_loader.rb +20 -0
- data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/test/test_rake_reduce_compat.rb +26 -0
- data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/test/test_rake_require.rb +40 -0
- data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/test/test_rake_rules.rb +388 -0
- data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/test/test_rake_scope.rb +44 -0
- data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/test/test_rake_task.rb +430 -0
- data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/test/test_rake_task_argument_parsing.rb +119 -0
- data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/test/test_rake_task_arguments.rb +134 -0
- data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/test/test_rake_task_manager.rb +178 -0
- data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/test/test_rake_task_manager_argument_resolution.rb +19 -0
- data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/test/test_rake_task_with_arguments.rb +172 -0
- data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/test/test_rake_test_task.rb +130 -0
- data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/test/test_rake_thread_pool.rb +145 -0
- data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/test/test_rake_top_level_functions.rb +71 -0
- data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/test/test_rake_win32.rb +72 -0
- data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/test/test_thread_history_display.rb +101 -0
- data/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/test/test_trace_output.rb +52 -0
- data/vendor/bundle/ruby/2.2.0/gems/test-unit-3.1.9/COPYING +64 -0
- data/vendor/bundle/ruby/2.2.0/gems/test-unit-3.1.9/GPL +339 -0
- data/vendor/bundle/ruby/2.2.0/gems/test-unit-3.1.9/LGPL +502 -0
- data/vendor/bundle/ruby/2.2.0/gems/test-unit-3.1.9/PSFL +271 -0
- data/vendor/bundle/ruby/2.2.0/gems/test-unit-3.1.9/README.md +101 -0
- data/vendor/bundle/ruby/2.2.0/gems/test-unit-3.1.9/Rakefile +71 -0
- data/vendor/bundle/ruby/2.2.0/gems/test-unit-3.1.9/lib/test-unit.rb +34 -0
- data/vendor/bundle/ruby/2.2.0/gems/test-unit-3.1.9/lib/test/unit.rb +505 -0
- data/vendor/bundle/ruby/2.2.0/gems/test-unit-3.1.9/lib/test/unit/assertion-failed-error.rb +25 -0
- data/vendor/bundle/ruby/2.2.0/gems/test-unit-3.1.9/lib/test/unit/assertions.rb +2218 -0
- data/vendor/bundle/ruby/2.2.0/gems/test-unit-3.1.9/lib/test/unit/attribute-matcher.rb +26 -0
- data/vendor/bundle/ruby/2.2.0/gems/test-unit-3.1.9/lib/test/unit/attribute.rb +158 -0
- data/vendor/bundle/ruby/2.2.0/gems/test-unit-3.1.9/lib/test/unit/auto-runner-loader.rb +17 -0
- data/vendor/bundle/ruby/2.2.0/gems/test-unit-3.1.9/lib/test/unit/autorunner.rb +536 -0
- data/vendor/bundle/ruby/2.2.0/gems/test-unit-3.1.9/lib/test/unit/code-snippet-fetcher.rb +58 -0
- data/vendor/bundle/ruby/2.2.0/gems/test-unit-3.1.9/lib/test/unit/collector.rb +73 -0
- data/vendor/bundle/ruby/2.2.0/gems/test-unit-3.1.9/lib/test/unit/collector/descendant.rb +19 -0
- data/vendor/bundle/ruby/2.2.0/gems/test-unit-3.1.9/lib/test/unit/collector/dir.rb +108 -0
- data/vendor/bundle/ruby/2.2.0/gems/test-unit-3.1.9/lib/test/unit/collector/load.rb +202 -0
- data/vendor/bundle/ruby/2.2.0/gems/test-unit-3.1.9/lib/test/unit/collector/objectspace.rb +34 -0
- data/vendor/bundle/ruby/2.2.0/gems/test-unit-3.1.9/lib/test/unit/collector/xml.rb +249 -0
- data/vendor/bundle/ruby/2.2.0/gems/test-unit-3.1.9/lib/test/unit/color-scheme.rb +198 -0
- data/vendor/bundle/ruby/2.2.0/gems/test-unit-3.1.9/lib/test/unit/color.rb +134 -0
- data/vendor/bundle/ruby/2.2.0/gems/test-unit-3.1.9/lib/test/unit/data.rb +262 -0
- data/vendor/bundle/ruby/2.2.0/gems/test-unit-3.1.9/lib/test/unit/diff.rb +746 -0
- data/vendor/bundle/ruby/2.2.0/gems/test-unit-3.1.9/lib/test/unit/error.rb +158 -0
- data/vendor/bundle/ruby/2.2.0/gems/test-unit-3.1.9/lib/test/unit/exception-handler.rb +82 -0
- data/vendor/bundle/ruby/2.2.0/gems/test-unit-3.1.9/lib/test/unit/failure.rb +169 -0
- data/vendor/bundle/ruby/2.2.0/gems/test-unit-3.1.9/lib/test/unit/fault-location-detector.rb +100 -0
- data/vendor/bundle/ruby/2.2.0/gems/test-unit-3.1.9/lib/test/unit/fixture.rb +295 -0
- data/vendor/bundle/ruby/2.2.0/gems/test-unit-3.1.9/lib/test/unit/notification.rb +136 -0
- data/vendor/bundle/ruby/2.2.0/gems/test-unit-3.1.9/lib/test/unit/omission.rb +195 -0
- data/vendor/bundle/ruby/2.2.0/gems/test-unit-3.1.9/lib/test/unit/pending.rb +154 -0
- data/vendor/bundle/ruby/2.2.0/gems/test-unit-3.1.9/lib/test/unit/priority.rb +192 -0
- data/vendor/bundle/ruby/2.2.0/gems/test-unit-3.1.9/lib/test/unit/runner/console.rb +59 -0
- data/vendor/bundle/ruby/2.2.0/gems/test-unit-3.1.9/lib/test/unit/runner/emacs.rb +8 -0
- data/vendor/bundle/ruby/2.2.0/gems/test-unit-3.1.9/lib/test/unit/runner/xml.rb +15 -0
- data/vendor/bundle/ruby/2.2.0/gems/test-unit-3.1.9/lib/test/unit/test-suite-creator.rb +89 -0
- data/vendor/bundle/ruby/2.2.0/gems/test-unit-3.1.9/lib/test/unit/testcase.rb +811 -0
- data/vendor/bundle/ruby/2.2.0/gems/test-unit-3.1.9/lib/test/unit/testresult.rb +132 -0
- data/vendor/bundle/ruby/2.2.0/gems/test-unit-3.1.9/lib/test/unit/testsuite.rb +175 -0
- data/vendor/bundle/ruby/2.2.0/gems/test-unit-3.1.9/lib/test/unit/ui/console/outputlevel.rb +15 -0
- data/vendor/bundle/ruby/2.2.0/gems/test-unit-3.1.9/lib/test/unit/ui/console/testrunner.rb +693 -0
- data/vendor/bundle/ruby/2.2.0/gems/test-unit-3.1.9/lib/test/unit/ui/emacs/testrunner.rb +49 -0
- data/vendor/bundle/ruby/2.2.0/gems/test-unit-3.1.9/lib/test/unit/ui/testrunner.rb +53 -0
- data/vendor/bundle/ruby/2.2.0/gems/test-unit-3.1.9/lib/test/unit/ui/testrunnermediator.rb +114 -0
- data/vendor/bundle/ruby/2.2.0/gems/test-unit-3.1.9/lib/test/unit/ui/testrunnerutilities.rb +41 -0
- data/vendor/bundle/ruby/2.2.0/gems/test-unit-3.1.9/lib/test/unit/ui/xml/testrunner.rb +224 -0
- data/vendor/bundle/ruby/2.2.0/gems/test-unit-3.1.9/lib/test/unit/util/backtracefilter.rb +59 -0
- data/vendor/bundle/ruby/2.2.0/gems/test-unit-3.1.9/lib/test/unit/util/method-owner-finder.rb +28 -0
- data/vendor/bundle/ruby/2.2.0/gems/test-unit-3.1.9/lib/test/unit/util/observable.rb +90 -0
- data/vendor/bundle/ruby/2.2.0/gems/test-unit-3.1.9/lib/test/unit/util/output.rb +31 -0
- data/vendor/bundle/ruby/2.2.0/gems/test-unit-3.1.9/lib/test/unit/util/procwrapper.rb +48 -0
- data/vendor/bundle/ruby/2.2.0/gems/test-unit-3.1.9/lib/test/unit/version.rb +5 -0
- data/vendor/bundle/ruby/2.2.0/gems/test-unit-3.1.9/sample/adder.rb +13 -0
- data/vendor/bundle/ruby/2.2.0/gems/test-unit-3.1.9/sample/subtracter.rb +12 -0
- data/vendor/bundle/ruby/2.2.0/gems/test-unit-3.1.9/sample/test_adder.rb +20 -0
- data/vendor/bundle/ruby/2.2.0/gems/test-unit-3.1.9/sample/test_subtracter.rb +20 -0
- data/vendor/bundle/ruby/2.2.0/gems/test-unit-3.1.9/sample/test_user.rb +23 -0
- data/vendor/bundle/ruby/2.2.0/gems/test-unit-3.1.9/test/collector/test-descendant.rb +178 -0
- data/vendor/bundle/ruby/2.2.0/gems/test-unit-3.1.9/test/collector/test-load.rb +442 -0
- data/vendor/bundle/ruby/2.2.0/gems/test-unit-3.1.9/test/collector/test_dir.rb +406 -0
- data/vendor/bundle/ruby/2.2.0/gems/test-unit-3.1.9/test/collector/test_objectspace.rb +100 -0
- data/vendor/bundle/ruby/2.2.0/gems/test-unit-3.1.9/test/fixtures/header-label.csv +3 -0
- data/vendor/bundle/ruby/2.2.0/gems/test-unit-3.1.9/test/fixtures/header-label.tsv +3 -0
- data/vendor/bundle/ruby/2.2.0/gems/test-unit-3.1.9/test/fixtures/header.csv +3 -0
- data/vendor/bundle/ruby/2.2.0/gems/test-unit-3.1.9/test/fixtures/header.tsv +3 -0
- data/vendor/bundle/ruby/2.2.0/gems/test-unit-3.1.9/test/fixtures/no-header.csv +2 -0
- data/vendor/bundle/ruby/2.2.0/gems/test-unit-3.1.9/test/fixtures/no-header.tsv +2 -0
- data/vendor/bundle/ruby/2.2.0/gems/test-unit-3.1.9/test/fixtures/plus.csv +3 -0
- data/vendor/bundle/ruby/2.2.0/gems/test-unit-3.1.9/test/run-test.rb +22 -0
- data/vendor/bundle/ruby/2.2.0/gems/test-unit-3.1.9/test/test-assertions.rb +2160 -0
- data/vendor/bundle/ruby/2.2.0/gems/test-unit-3.1.9/test/test-attribute-matcher.rb +38 -0
- data/vendor/bundle/ruby/2.2.0/gems/test-unit-3.1.9/test/test-attribute.rb +123 -0
- data/vendor/bundle/ruby/2.2.0/gems/test-unit-3.1.9/test/test-code-snippet.rb +37 -0
- data/vendor/bundle/ruby/2.2.0/gems/test-unit-3.1.9/test/test-color-scheme.rb +82 -0
- data/vendor/bundle/ruby/2.2.0/gems/test-unit-3.1.9/test/test-color.rb +47 -0
- data/vendor/bundle/ruby/2.2.0/gems/test-unit-3.1.9/test/test-data.rb +303 -0
- data/vendor/bundle/ruby/2.2.0/gems/test-unit-3.1.9/test/test-diff.rb +518 -0
- data/vendor/bundle/ruby/2.2.0/gems/test-unit-3.1.9/test/test-emacs-runner.rb +60 -0
- data/vendor/bundle/ruby/2.2.0/gems/test-unit-3.1.9/test/test-error.rb +26 -0
- data/vendor/bundle/ruby/2.2.0/gems/test-unit-3.1.9/test/test-failure.rb +33 -0
- data/vendor/bundle/ruby/2.2.0/gems/test-unit-3.1.9/test/test-fault-location-detector.rb +163 -0
- data/vendor/bundle/ruby/2.2.0/gems/test-unit-3.1.9/test/test-fixture.rb +713 -0
- data/vendor/bundle/ruby/2.2.0/gems/test-unit-3.1.9/test/test-notification.rb +33 -0
- data/vendor/bundle/ruby/2.2.0/gems/test-unit-3.1.9/test/test-omission.rb +81 -0
- data/vendor/bundle/ruby/2.2.0/gems/test-unit-3.1.9/test/test-pending.rb +70 -0
- data/vendor/bundle/ruby/2.2.0/gems/test-unit-3.1.9/test/test-priority.rb +173 -0
- data/vendor/bundle/ruby/2.2.0/gems/test-unit-3.1.9/test/test-test-case.rb +1171 -0
- data/vendor/bundle/ruby/2.2.0/gems/test-unit-3.1.9/test/test-test-result.rb +113 -0
- data/vendor/bundle/ruby/2.2.0/gems/test-unit-3.1.9/test/test-test-suite-creator.rb +97 -0
- data/vendor/bundle/ruby/2.2.0/gems/test-unit-3.1.9/test/test-test-suite.rb +150 -0
- data/vendor/bundle/ruby/2.2.0/gems/test-unit-3.1.9/test/testunit-test-util.rb +31 -0
- data/vendor/bundle/ruby/2.2.0/gems/test-unit-3.1.9/test/ui/test_testrunmediator.rb +20 -0
- data/vendor/bundle/ruby/2.2.0/gems/test-unit-3.1.9/test/util/test-method-owner-finder.rb +38 -0
- data/vendor/bundle/ruby/2.2.0/gems/test-unit-3.1.9/test/util/test-output.rb +11 -0
- data/vendor/bundle/ruby/2.2.0/gems/test-unit-3.1.9/test/util/test_backtracefilter.rb +52 -0
- data/vendor/bundle/ruby/2.2.0/gems/test-unit-3.1.9/test/util/test_observable.rb +102 -0
- data/vendor/bundle/ruby/2.2.0/gems/test-unit-3.1.9/test/util/test_procwrapper.rb +36 -0
- data/vendor/bundle/ruby/2.2.0/specifications/colorize-0.7.7.gemspec +38 -0
- data/vendor/bundle/ruby/2.2.0/specifications/devkit-0.1.0.gemspec +46 -0
- data/vendor/bundle/ruby/2.2.0/specifications/highline-1.7.8.gemspec +37 -0
- data/vendor/bundle/ruby/2.2.0/specifications/power_assert-0.3.0.gemspec +41 -0
- data/vendor/bundle/ruby/2.2.0/specifications/rake-11.1.2.gemspec +43 -0
- data/vendor/bundle/ruby/2.2.0/specifications/test-unit-3.1.9.gemspec +47 -0
- data/win32-api.gemspec +27 -27
- metadata +345 -5
- data/lib/win32/ruby18/win32/api.so +0 -0
- data/lib/win32/ruby19/win32/api.so +0 -0
@@ -0,0 +1,23 @@
|
|
1
|
+
require 'test/unit'
|
2
|
+
require 'highline/import'
|
3
|
+
require 'highline/simulate'
|
4
|
+
|
5
|
+
class SimulatorTest < Test::Unit::TestCase
|
6
|
+
def setup
|
7
|
+
input = StringIO.new
|
8
|
+
output = StringIO.new
|
9
|
+
$terminal = HighLine.new(input, output)
|
10
|
+
end
|
11
|
+
|
12
|
+
def test_simulator
|
13
|
+
HighLine::Simulate.with('Bugs Bunny', '18') do
|
14
|
+
name = ask('What is your name?')
|
15
|
+
|
16
|
+
assert_equal 'Bugs Bunny', name
|
17
|
+
|
18
|
+
age = ask('What is your age?')
|
19
|
+
|
20
|
+
assert_equal '18', age
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
@@ -0,0 +1,38 @@
|
|
1
|
+
# tc_highline_string.rb
|
2
|
+
#
|
3
|
+
# Created by Richard LeBer 2011-06-27
|
4
|
+
#
|
5
|
+
# This is Free Software. See LICENSE and COPYING for details.
|
6
|
+
|
7
|
+
require "test/unit"
|
8
|
+
|
9
|
+
require "highline"
|
10
|
+
require "stringio"
|
11
|
+
require "string_methods"
|
12
|
+
|
13
|
+
class TestHighLineString < Test::Unit::TestCase
|
14
|
+
def setup
|
15
|
+
@string = HighLine::String.new("string")
|
16
|
+
end
|
17
|
+
|
18
|
+
def test_string_class
|
19
|
+
# Basic constructor
|
20
|
+
assert_equal HighLine::String, @string.class
|
21
|
+
assert_equal "string", @string
|
22
|
+
|
23
|
+
# Alternative constructor method
|
24
|
+
new_string = HighLine::String("string")
|
25
|
+
assert_equal HighLine::String, new_string.class
|
26
|
+
assert_equal @string, new_string
|
27
|
+
|
28
|
+
# String methods work
|
29
|
+
assert_equal 6, @string.size
|
30
|
+
assert_equal "STRING", @string.upcase
|
31
|
+
end
|
32
|
+
|
33
|
+
include StringMethods
|
34
|
+
|
35
|
+
def test_string_class_is_unchanged
|
36
|
+
assert_raise(::NoMethodError) { "string".color(:blue) }
|
37
|
+
end
|
38
|
+
end
|
@@ -0,0 +1,578 @@
|
|
1
|
+
# tc_style.rb
|
2
|
+
#
|
3
|
+
# Created by Richard LeBer on 2011-06-11.
|
4
|
+
#
|
5
|
+
# This is Free Software. See LICENSE and COPYING for details.
|
6
|
+
|
7
|
+
require "test/unit"
|
8
|
+
|
9
|
+
require "highline"
|
10
|
+
require "stringio"
|
11
|
+
|
12
|
+
class TestStyle < Test::Unit::TestCase
|
13
|
+
|
14
|
+
def setup
|
15
|
+
@input = StringIO.new
|
16
|
+
@output = StringIO.new
|
17
|
+
@terminal = HighLine.new(@input, @output)
|
18
|
+
@style1 = HighLine::Style.new(:name=>:foo, :code=>"\e[99m", :rgb=>[1,2,3])
|
19
|
+
@style2 = HighLine::Style.new(:name=>:lando, :code=>"\e[98m")
|
20
|
+
@style3 = HighLine::Style.new(:name=>[:foo, :lando], :list=>[:foo, :lando])
|
21
|
+
@style4 = HighLine::Style(:rgb_654321)
|
22
|
+
end
|
23
|
+
|
24
|
+
def teardown
|
25
|
+
# HighLine::Style.clear_index
|
26
|
+
end
|
27
|
+
|
28
|
+
def test_style_method
|
29
|
+
# Retrieve a style from an existing Style (no new Style created)
|
30
|
+
new_style = @style1.dup # This will replace @style1 in the indexes
|
31
|
+
s = HighLine.Style(@style1)
|
32
|
+
assert_instance_of HighLine::Style, s
|
33
|
+
assert_same new_style, s # i.e. s===the latest style created, but not the one searched for
|
34
|
+
|
35
|
+
# Retrieve a style from a new Style (no new Style created)
|
36
|
+
s2 = HighLine::Style.new(:name=>:bar, :code=>"\e[97m")
|
37
|
+
s = HighLine.Style(s2)
|
38
|
+
assert_instance_of HighLine::Style, s
|
39
|
+
assert_same s2, s
|
40
|
+
|
41
|
+
# Create a builtin style from an existing ANSI escape string
|
42
|
+
s = HighLine.Style("\e[1m")
|
43
|
+
assert_instance_of HighLine::Style, s
|
44
|
+
assert_nil s.list
|
45
|
+
assert_equal "\e[1m", s.code
|
46
|
+
assert_equal :bold, s.name
|
47
|
+
|
48
|
+
# Create a builtin style from a new ANSI escape string
|
49
|
+
s = HighLine.Style("\e[96m")
|
50
|
+
assert_instance_of HighLine::Style, s
|
51
|
+
assert_nil s.list
|
52
|
+
assert_equal "\e[96m", s.code
|
53
|
+
|
54
|
+
# Create a builtin style from a symbol
|
55
|
+
s = HighLine.Style(:red)
|
56
|
+
assert_instance_of HighLine::Style, s
|
57
|
+
assert_nil s.list
|
58
|
+
assert_equal :red, s.name
|
59
|
+
|
60
|
+
# Retrieve an existing style by name (no new Style created)
|
61
|
+
s = HighLine.Style(@style2.name)
|
62
|
+
assert_instance_of HighLine::Style, s
|
63
|
+
assert_same @style2, s
|
64
|
+
|
65
|
+
# See below for color scheme tests
|
66
|
+
|
67
|
+
# Create style from a Hash
|
68
|
+
s = HighLine.Style(:name=>:han, :code=>"blah", :rgb=>'phooey')
|
69
|
+
assert_instance_of HighLine::Style, s
|
70
|
+
assert_equal :han, s.name
|
71
|
+
assert_equal "blah", s.code
|
72
|
+
assert_equal "phooey", s.rgb
|
73
|
+
|
74
|
+
# Create style from an RGB foreground color code
|
75
|
+
s = HighLine.Style(:rgb_1f2e3d)
|
76
|
+
assert_instance_of HighLine::Style, s
|
77
|
+
assert_equal :rgb_1f2e3d, s.name
|
78
|
+
assert_equal "\e[38;5;23m", s.code # Trust me; more testing below
|
79
|
+
assert_equal [31,46,61], s.rgb # 0x1f==31, 0x2e==46, 0x3d=61
|
80
|
+
|
81
|
+
# Create style from an RGB background color code
|
82
|
+
s = HighLine.Style(:on_rgb_1f2e3d)
|
83
|
+
assert_instance_of HighLine::Style, s
|
84
|
+
assert_equal :on_rgb_1f2e3d, s.name
|
85
|
+
assert_equal "\e[48;5;23m", s.code # Trust me; more testing below
|
86
|
+
assert_equal [31,46,61], s.rgb # 0x1f==31, 0x2e==46, 0x3d=61
|
87
|
+
|
88
|
+
# Create a style list
|
89
|
+
s1 = HighLine.Style(:bold, :red)
|
90
|
+
assert_instance_of HighLine::Style, s1
|
91
|
+
assert_equal [:bold, :red], s1.list
|
92
|
+
|
93
|
+
# Find an existing style list
|
94
|
+
s2 = HighLine.Style(:bold, :red)
|
95
|
+
assert_instance_of HighLine::Style, s2
|
96
|
+
assert_same s1, s2
|
97
|
+
|
98
|
+
# Create a style list with nils
|
99
|
+
s1 = HighLine.Style(:underline, nil, :blue)
|
100
|
+
assert_instance_of HighLine::Style, s1
|
101
|
+
assert_equal [:underline, :blue], s1.list
|
102
|
+
|
103
|
+
# Raise an error for an undefined style
|
104
|
+
assert_raise(::NameError) { HighLine.Style(:fubar) }
|
105
|
+
end
|
106
|
+
|
107
|
+
def test_no_color_scheme
|
108
|
+
HighLine.color_scheme = nil
|
109
|
+
assert_raise(::NameError) { HighLine.Style(:critical) }
|
110
|
+
end
|
111
|
+
|
112
|
+
def test_with_color_scheme
|
113
|
+
HighLine.color_scheme = HighLine::SampleColorScheme.new
|
114
|
+
s = HighLine.Style(:critical)
|
115
|
+
assert_instance_of HighLine::Style, s
|
116
|
+
assert_equal :critical, s.name
|
117
|
+
assert_equal [:yellow, :on_red], s.list
|
118
|
+
end
|
119
|
+
|
120
|
+
def test_builtin_foreground_colors_defined
|
121
|
+
HighLine::COLORS.each do |color|
|
122
|
+
style = HighLine.const_get(color+'_STYLE')
|
123
|
+
assert_instance_of HighLine::Style, style
|
124
|
+
assert_equal color.downcase.to_sym, style.name
|
125
|
+
assert style.builtin
|
126
|
+
code = HighLine.const_get(color)
|
127
|
+
assert_instance_of String, code, "Bad code for #{color}"
|
128
|
+
end
|
129
|
+
end
|
130
|
+
|
131
|
+
def test_builtin_background_colors_defined
|
132
|
+
HighLine::COLORS.each do |color|
|
133
|
+
style = HighLine.const_get('ON_' + color+'_STYLE')
|
134
|
+
assert_instance_of HighLine::Style, style
|
135
|
+
assert_equal "ON_#{color}".downcase.to_sym, style.name
|
136
|
+
assert style.builtin
|
137
|
+
code = HighLine.const_get('ON_' + color)
|
138
|
+
assert_instance_of String, code, "Bad code for ON_#{color}"
|
139
|
+
end
|
140
|
+
end
|
141
|
+
|
142
|
+
def test_builtin_styles_defined
|
143
|
+
HighLine::STYLES.each do |style_constant|
|
144
|
+
style = HighLine.const_get(style_constant+'_STYLE')
|
145
|
+
assert_instance_of HighLine::Style, style
|
146
|
+
assert_equal style_constant.downcase.to_sym, style.name
|
147
|
+
assert style.builtin
|
148
|
+
code = HighLine.const_get(style_constant)
|
149
|
+
assert_instance_of String, code, "Bad code for #{style_constant}"
|
150
|
+
end
|
151
|
+
end
|
152
|
+
|
153
|
+
def test_index
|
154
|
+
# Add a Style with a new name and code
|
155
|
+
assert_nil HighLine::Style.list[:s1]
|
156
|
+
assert_nil HighLine::Style.code_index['foo']
|
157
|
+
s1 = HighLine::Style.new(:name=>:s1, :code=>'foo')
|
158
|
+
assert_not_nil HighLine::Style.list[:s1]
|
159
|
+
assert_same s1, HighLine::Style.list[:s1]
|
160
|
+
assert_equal :s1, HighLine::Style.list[:s1].name
|
161
|
+
assert_equal 'foo', HighLine::Style.list[:s1].code
|
162
|
+
styles = HighLine::Style.list.size
|
163
|
+
codes = HighLine::Style.code_index.size
|
164
|
+
assert_instance_of Array, HighLine::Style.code_index['foo']
|
165
|
+
assert_equal 1, HighLine::Style.code_index['foo'].size
|
166
|
+
assert_same s1, HighLine::Style.code_index['foo'].last
|
167
|
+
assert_equal :s1, HighLine::Style.code_index['foo'].last.name
|
168
|
+
assert_equal 'foo', HighLine::Style.code_index['foo'].last.code
|
169
|
+
|
170
|
+
# Add another Style with a new name and code
|
171
|
+
assert_nil HighLine::Style.list[:s2]
|
172
|
+
assert_nil HighLine::Style.code_index['bar']
|
173
|
+
s2 = HighLine::Style.new(:name=>:s2, :code=>'bar')
|
174
|
+
assert_equal styles+1, HighLine::Style.list.size
|
175
|
+
assert_equal codes+1, HighLine::Style.code_index.size
|
176
|
+
assert_not_nil HighLine::Style.list[:s2]
|
177
|
+
assert_same s2, HighLine::Style.list[:s2]
|
178
|
+
assert_equal :s2, HighLine::Style.list[:s2].name
|
179
|
+
assert_equal 'bar', HighLine::Style.list[:s2].code
|
180
|
+
assert_instance_of Array, HighLine::Style.code_index['bar']
|
181
|
+
assert_equal 1, HighLine::Style.code_index['bar'].size
|
182
|
+
assert_same s2, HighLine::Style.code_index['bar'].last
|
183
|
+
assert_equal :s2, HighLine::Style.code_index['bar'].last.name
|
184
|
+
assert_equal 'bar', HighLine::Style.code_index['bar'].last.code
|
185
|
+
|
186
|
+
# Add a Style with an existing name
|
187
|
+
s3_before = HighLine::Style.list[:s2]
|
188
|
+
assert_not_nil HighLine::Style.list[:s2]
|
189
|
+
assert_nil HighLine::Style.code_index['baz']
|
190
|
+
s3 = HighLine::Style.new(:name=>:s2, :code=>'baz')
|
191
|
+
assert_not_same s2, s3
|
192
|
+
assert_not_same s3_before, s3
|
193
|
+
assert_equal styles+1, HighLine::Style.list.size
|
194
|
+
assert_equal codes+2, HighLine::Style.code_index.size
|
195
|
+
assert_not_nil HighLine::Style.list[:s2]
|
196
|
+
assert_same s3, HighLine::Style.list[:s2]
|
197
|
+
assert_not_same s2, HighLine::Style.list[:s2]
|
198
|
+
assert_equal :s2, HighLine::Style.list[:s2].name
|
199
|
+
assert_equal 'baz', HighLine::Style.list[:s2].code
|
200
|
+
assert_instance_of Array, HighLine::Style.code_index['baz']
|
201
|
+
assert_equal 1, HighLine::Style.code_index['baz'].size
|
202
|
+
assert_same s3, HighLine::Style.code_index['baz'].last
|
203
|
+
assert_equal :s2, HighLine::Style.code_index['baz'].last.name
|
204
|
+
assert_equal 'baz', HighLine::Style.code_index['baz'].last.code
|
205
|
+
|
206
|
+
# Add a Style with an existing code
|
207
|
+
assert_equal 1, HighLine::Style.code_index['baz'].size
|
208
|
+
s4 = HighLine::Style.new(:name=>:s4, :code=>'baz')
|
209
|
+
assert_equal styles+2, HighLine::Style.list.size
|
210
|
+
assert_equal codes+2, HighLine::Style.code_index.size
|
211
|
+
assert_not_nil HighLine::Style.list[:s4]
|
212
|
+
assert_same s4, HighLine::Style.list[:s4]
|
213
|
+
assert_equal :s4, HighLine::Style.list[:s4].name
|
214
|
+
assert_equal 'baz', HighLine::Style.list[:s4].code
|
215
|
+
assert_equal 2, HighLine::Style.code_index['baz'].size
|
216
|
+
assert_same s3, HighLine::Style.code_index['baz'].first # Unchanged from last time
|
217
|
+
assert_equal :s2, HighLine::Style.code_index['baz'].first.name # Unchanged from last time
|
218
|
+
assert_equal 'baz', HighLine::Style.code_index['baz'].first.code # Unchanged from last time
|
219
|
+
assert_same s4, HighLine::Style.code_index['baz'].last
|
220
|
+
assert_equal :s4, HighLine::Style.code_index['baz'].last.name
|
221
|
+
assert_equal 'baz', HighLine::Style.code_index['baz'].last.code
|
222
|
+
end
|
223
|
+
|
224
|
+
def test_rgb_hex
|
225
|
+
assert_equal "abcdef", HighLine::Style.rgb_hex("abcdef")
|
226
|
+
assert_equal "ABCDEF", HighLine::Style.rgb_hex("AB","CD","EF")
|
227
|
+
assert_equal "010203", HighLine::Style.rgb_hex(1,2,3)
|
228
|
+
assert_equal "123456", HighLine::Style.rgb_hex(18,52,86)
|
229
|
+
end
|
230
|
+
|
231
|
+
def test_rgb_parts
|
232
|
+
assert_equal [1,2,3], HighLine::Style.rgb_parts("010203")
|
233
|
+
assert_equal [18,52,86], HighLine::Style.rgb_parts("123456")
|
234
|
+
end
|
235
|
+
|
236
|
+
def test_rgb
|
237
|
+
s = HighLine::Style.rgb(1, 2, 3)
|
238
|
+
assert_instance_of HighLine::Style, s
|
239
|
+
assert_equal :rgb_010203, s.name
|
240
|
+
assert_equal [1,2,3], s.rgb
|
241
|
+
assert_equal "\e[38;5;16m", s.code
|
242
|
+
|
243
|
+
s = HighLine::Style.rgb("12", "34","56")
|
244
|
+
assert_instance_of HighLine::Style, s
|
245
|
+
assert_equal :rgb_123456, s.name
|
246
|
+
assert_equal [0x12, 0x34, 0x56], s.rgb
|
247
|
+
assert_equal "\e[38;5;24m", s.code
|
248
|
+
|
249
|
+
s = HighLine::Style.rgb("abcdef")
|
250
|
+
assert_instance_of HighLine::Style, s
|
251
|
+
assert_equal :rgb_abcdef, s.name
|
252
|
+
assert_equal [0xab, 0xcd, 0xef], s.rgb
|
253
|
+
assert_equal "\e[38;5;189m", s.code
|
254
|
+
end
|
255
|
+
|
256
|
+
def test_rgb_number
|
257
|
+
# ANSI RGB coding splits 0..255 into equal sixths, and then the
|
258
|
+
# red green and blue are encoded in base 6, plus 16, i.e.
|
259
|
+
# 16 + 36*(red_level) + 6*(green_level) + blue_level,
|
260
|
+
# where each of red_level, green_level, and blue_level are in
|
261
|
+
# the range 0..5
|
262
|
+
|
263
|
+
# This test logic works because 42 is just below 1/6 of 255,
|
264
|
+
# and 43 is just above
|
265
|
+
|
266
|
+
assert_equal 16 + 0*36 + 0*6 + 0, HighLine::Style.rgb_number( 0, 0, 0)
|
267
|
+
assert_equal 16 + 0*36 + 0*6 + 0, HighLine::Style.rgb_number( 0, 0, 42)
|
268
|
+
assert_equal 16 + 0*36 + 0*6 + 1, HighLine::Style.rgb_number( 0, 0, 43)
|
269
|
+
|
270
|
+
assert_equal 16 + 0*36 + 0*6 + 0, HighLine::Style.rgb_number( 0, 42, 0)
|
271
|
+
assert_equal 16 + 0*36 + 0*6 + 0, HighLine::Style.rgb_number( 0, 42, 42)
|
272
|
+
assert_equal 16 + 0*36 + 0*6 + 1, HighLine::Style.rgb_number( 0, 42, 43)
|
273
|
+
|
274
|
+
assert_equal 16 + 0*36 + 1*6 + 0, HighLine::Style.rgb_number( 0, 43, 0)
|
275
|
+
assert_equal 16 + 0*36 + 1*6 + 0, HighLine::Style.rgb_number( 0, 43, 42)
|
276
|
+
assert_equal 16 + 0*36 + 1*6 + 1, HighLine::Style.rgb_number( 0, 43, 43)
|
277
|
+
|
278
|
+
assert_equal 16 + 0*36 + 0*6 + 0, HighLine::Style.rgb_number( 42, 0, 0)
|
279
|
+
assert_equal 16 + 0*36 + 0*6 + 0, HighLine::Style.rgb_number( 42, 0, 42)
|
280
|
+
assert_equal 16 + 0*36 + 0*6 + 1, HighLine::Style.rgb_number( 42, 0, 43)
|
281
|
+
|
282
|
+
assert_equal 16 + 0*36 + 0*6 + 0, HighLine::Style.rgb_number( 42, 42, 0)
|
283
|
+
assert_equal 16 + 0*36 + 0*6 + 0, HighLine::Style.rgb_number( 42, 42, 42)
|
284
|
+
assert_equal 16 + 0*36 + 0*6 + 1, HighLine::Style.rgb_number( 42, 42, 43)
|
285
|
+
|
286
|
+
assert_equal 16 + 0*36 + 1*6 + 0, HighLine::Style.rgb_number( 42, 43, 0)
|
287
|
+
assert_equal 16 + 0*36 + 1*6 + 0, HighLine::Style.rgb_number( 42, 43, 42)
|
288
|
+
assert_equal 16 + 0*36 + 1*6 + 1, HighLine::Style.rgb_number( 42, 43, 43)
|
289
|
+
|
290
|
+
assert_equal 16 + 1*36 + 0*6 + 0, HighLine::Style.rgb_number( 43, 0, 0)
|
291
|
+
assert_equal 16 + 1*36 + 0*6 + 0, HighLine::Style.rgb_number( 43, 0, 42)
|
292
|
+
assert_equal 16 + 1*36 + 0*6 + 1, HighLine::Style.rgb_number( 43, 0, 43)
|
293
|
+
|
294
|
+
assert_equal 16 + 1*36 + 0*6 + 0, HighLine::Style.rgb_number( 43, 42, 0)
|
295
|
+
assert_equal 16 + 1*36 + 0*6 + 0, HighLine::Style.rgb_number( 43, 42, 42)
|
296
|
+
assert_equal 16 + 1*36 + 0*6 + 1, HighLine::Style.rgb_number( 43, 42, 43)
|
297
|
+
|
298
|
+
assert_equal 16 + 1*36 + 1*6 + 0, HighLine::Style.rgb_number( 43, 43, 0)
|
299
|
+
assert_equal 16 + 1*36 + 1*6 + 0, HighLine::Style.rgb_number( 43, 43, 42)
|
300
|
+
assert_equal 16 + 1*36 + 1*6 + 1, HighLine::Style.rgb_number( 43, 43, 43)
|
301
|
+
|
302
|
+
assert_equal 16 + 5*36 + 5*6 + 5, HighLine::Style.rgb_number(255,255,255)
|
303
|
+
end
|
304
|
+
|
305
|
+
def test_ansi_rgb_to_hex
|
306
|
+
assert_equal "000000", HighLine::Style.ansi_rgb_to_hex(16 + 0*36 + 0*6 + 0)
|
307
|
+
assert_equal "000000", HighLine::Style.ansi_rgb_to_hex(16 + 0*36 + 0*6 + 0)
|
308
|
+
assert_equal "00002b", HighLine::Style.ansi_rgb_to_hex(16 + 0*36 + 0*6 + 1)
|
309
|
+
|
310
|
+
assert_equal "000000", HighLine::Style.ansi_rgb_to_hex(16 + 0*36 + 0*6 + 0)
|
311
|
+
assert_equal "000000", HighLine::Style.ansi_rgb_to_hex(16 + 0*36 + 0*6 + 0)
|
312
|
+
assert_equal "00002b", HighLine::Style.ansi_rgb_to_hex(16 + 0*36 + 0*6 + 1)
|
313
|
+
|
314
|
+
assert_equal "002b00", HighLine::Style.ansi_rgb_to_hex(16 + 0*36 + 1*6 + 0)
|
315
|
+
assert_equal "002b00", HighLine::Style.ansi_rgb_to_hex(16 + 0*36 + 1*6 + 0)
|
316
|
+
assert_equal "002b2b", HighLine::Style.ansi_rgb_to_hex(16 + 0*36 + 1*6 + 1)
|
317
|
+
|
318
|
+
assert_equal "000000", HighLine::Style.ansi_rgb_to_hex(16 + 0*36 + 0*6 + 0)
|
319
|
+
assert_equal "000000", HighLine::Style.ansi_rgb_to_hex(16 + 0*36 + 0*6 + 0)
|
320
|
+
assert_equal "00002b", HighLine::Style.ansi_rgb_to_hex(16 + 0*36 + 0*6 + 1)
|
321
|
+
|
322
|
+
assert_equal "000000", HighLine::Style.ansi_rgb_to_hex(16 + 0*36 + 0*6 + 0)
|
323
|
+
assert_equal "000000", HighLine::Style.ansi_rgb_to_hex(16 + 0*36 + 0*6 + 0)
|
324
|
+
assert_equal "00002b", HighLine::Style.ansi_rgb_to_hex(16 + 0*36 + 0*6 + 1)
|
325
|
+
|
326
|
+
assert_equal "002b00", HighLine::Style.ansi_rgb_to_hex(16 + 0*36 + 1*6 + 0)
|
327
|
+
assert_equal "002b00", HighLine::Style.ansi_rgb_to_hex(16 + 0*36 + 1*6 + 0)
|
328
|
+
assert_equal "002b2b", HighLine::Style.ansi_rgb_to_hex(16 + 0*36 + 1*6 + 1)
|
329
|
+
|
330
|
+
assert_equal "2b0000", HighLine::Style.ansi_rgb_to_hex(16 + 1*36 + 0*6 + 0)
|
331
|
+
assert_equal "2b0000", HighLine::Style.ansi_rgb_to_hex(16 + 1*36 + 0*6 + 0)
|
332
|
+
assert_equal "2b002b", HighLine::Style.ansi_rgb_to_hex(16 + 1*36 + 0*6 + 1)
|
333
|
+
|
334
|
+
assert_equal "2b0000", HighLine::Style.ansi_rgb_to_hex(16 + 1*36 + 0*6 + 0)
|
335
|
+
assert_equal "2b0000", HighLine::Style.ansi_rgb_to_hex(16 + 1*36 + 0*6 + 0)
|
336
|
+
assert_equal "2b002b", HighLine::Style.ansi_rgb_to_hex(16 + 1*36 + 0*6 + 1)
|
337
|
+
|
338
|
+
assert_equal "2b2b00", HighLine::Style.ansi_rgb_to_hex(16 + 1*36 + 1*6 + 0)
|
339
|
+
assert_equal "2b2b00", HighLine::Style.ansi_rgb_to_hex(16 + 1*36 + 1*6 + 0)
|
340
|
+
assert_equal "2b2b2b", HighLine::Style.ansi_rgb_to_hex(16 + 1*36 + 1*6 + 1)
|
341
|
+
|
342
|
+
# 0xd5 is the smallest number where n/255.0*6.0 > 5
|
343
|
+
assert_equal "d5d5d5", HighLine::Style.ansi_rgb_to_hex(16 + 5*36 + 5*6 + 5)
|
344
|
+
end
|
345
|
+
|
346
|
+
def test_list
|
347
|
+
list_size = HighLine::Style.list.size
|
348
|
+
# Add a Style with a new name and code
|
349
|
+
assert_nil HighLine::Style.list[:s5]
|
350
|
+
s5 = HighLine::Style.new(:name=>:s5, :code=>'foo')
|
351
|
+
assert_not_nil HighLine::Style.list[:s5]
|
352
|
+
assert_equal list_size+1, HighLine::Style.list.size
|
353
|
+
assert_not_nil HighLine::Style.list[:s5]
|
354
|
+
assert_same s5, HighLine::Style.list[:s5]
|
355
|
+
assert_equal :s5, HighLine::Style.list[:s5].name
|
356
|
+
assert_equal 'foo', HighLine::Style.list[:s5].code
|
357
|
+
|
358
|
+
# Add another Style with a new name and code
|
359
|
+
assert_nil HighLine::Style.list[:s6]
|
360
|
+
s6 = HighLine::Style.new(:name=>:s6, :code=>'bar')
|
361
|
+
assert_equal list_size+2, HighLine::Style.list.size
|
362
|
+
assert_not_nil HighLine::Style.list[:s6]
|
363
|
+
assert_same s6, HighLine::Style.list[:s6]
|
364
|
+
assert_equal :s6, HighLine::Style.list[:s6].name
|
365
|
+
assert_equal 'bar', HighLine::Style.list[:s6].code
|
366
|
+
|
367
|
+
# Add a Style with an existing name
|
368
|
+
s7 = HighLine::Style.new(:name=>:s6, :code=>'baz')
|
369
|
+
assert_equal list_size+2, HighLine::Style.list.size # No net addition to list
|
370
|
+
assert_not_nil HighLine::Style.list[:s6]
|
371
|
+
assert_same s7, HighLine::Style.list[:s6] # New one replaces old one
|
372
|
+
assert_not_same s6, HighLine::Style.list[:s6]
|
373
|
+
assert_equal :s6, HighLine::Style.list[:s6].name
|
374
|
+
assert_equal 'baz', HighLine::Style.list[:s6].code
|
375
|
+
end
|
376
|
+
|
377
|
+
def test_code_index
|
378
|
+
list_size = HighLine::Style.code_index.size
|
379
|
+
|
380
|
+
# Add a Style with a new name and code
|
381
|
+
assert_nil HighLine::Style.code_index['chewie']
|
382
|
+
HighLine::Style.new(:name=>:s8, :code=>'chewie')
|
383
|
+
assert_equal list_size+1, HighLine::Style.code_index.size
|
384
|
+
assert_instance_of Array, HighLine::Style.code_index['chewie']
|
385
|
+
assert_equal 1, HighLine::Style.code_index['chewie'].size
|
386
|
+
assert_equal :s8, HighLine::Style.code_index['chewie'].last.name
|
387
|
+
assert_equal 'chewie', HighLine::Style.code_index['chewie'].last.code
|
388
|
+
|
389
|
+
# Add another Style with a new name and code
|
390
|
+
assert_nil HighLine::Style.code_index['c3po']
|
391
|
+
HighLine::Style.new(:name=>:s9, :code=>'c3po')
|
392
|
+
assert_equal list_size+2, HighLine::Style.code_index.size
|
393
|
+
assert_instance_of Array, HighLine::Style.code_index['c3po']
|
394
|
+
assert_equal 1, HighLine::Style.code_index['c3po'].size
|
395
|
+
assert_equal :s9, HighLine::Style.code_index['c3po'].last.name
|
396
|
+
assert_equal 'c3po', HighLine::Style.code_index['c3po'].last.code
|
397
|
+
|
398
|
+
# Add a Style with an existing code
|
399
|
+
assert_equal 1, HighLine::Style.code_index['c3po'].size
|
400
|
+
HighLine::Style.new(:name=>:s10, :code=>'c3po')
|
401
|
+
assert_equal list_size+2, HighLine::Style.code_index.size
|
402
|
+
assert_equal 2, HighLine::Style.code_index['c3po'].size
|
403
|
+
assert_equal :s10, HighLine::Style.code_index['c3po'].last.name
|
404
|
+
assert_equal 'c3po', HighLine::Style.code_index['c3po'].last.code
|
405
|
+
end
|
406
|
+
|
407
|
+
def test_uncolor
|
408
|
+
# Normal color
|
409
|
+
assert_equal "This should be reverse underlined magenta!\n",
|
410
|
+
HighLine::Style.uncolor("This should be \e[7m\e[4m\e[35mreverse underlined magenta\e[0m!\n" )
|
411
|
+
|
412
|
+
# RGB color
|
413
|
+
assert_equal "This should be rgb_906030!\n",
|
414
|
+
HighLine::Style.uncolor("This should be \e[38;5;137mrgb_906030\e[0m!\n" )
|
415
|
+
end
|
416
|
+
|
417
|
+
def test_color
|
418
|
+
assert_equal "\e[99mstring\e[0m", @style1.color("string") # simple style
|
419
|
+
assert_equal "\e[99m\e[98mstring\e[0m", @style3.color("string") # Style list
|
420
|
+
end
|
421
|
+
|
422
|
+
def test_code
|
423
|
+
assert_equal "\e[99m", @style1.code # simple style
|
424
|
+
assert_equal "\e[99m\e[98m", @style3.code # Style list
|
425
|
+
end
|
426
|
+
|
427
|
+
def test_red
|
428
|
+
assert_equal 0x65, @style4.red
|
429
|
+
assert_equal 0, HighLine::Style(:none).red # Probably reliable
|
430
|
+
assert_equal 0, HighLine::Style(:black).red # Probably reliable
|
431
|
+
assert_equal 255, HighLine::Style(:bright_magenta).red # Seems to be reliable
|
432
|
+
assert_equal 255, HighLine::Style(:on_none).red # Probably reliable
|
433
|
+
end
|
434
|
+
|
435
|
+
def test_green
|
436
|
+
assert_equal 0x43, @style4.green
|
437
|
+
assert_equal 0, HighLine::Style(:none).green # Probably reliable
|
438
|
+
assert_equal 0, HighLine::Style(:black).green # Probably reliable
|
439
|
+
assert 240 <= HighLine::Style(:bright_cyan).green # Probably reliable
|
440
|
+
assert_equal 255, HighLine::Style(:on_none).green # Probably reliable
|
441
|
+
end
|
442
|
+
|
443
|
+
def test_blue
|
444
|
+
assert_equal 0x21, @style4.blue
|
445
|
+
assert_equal 0, HighLine::Style(:none).blue # Probably reliable
|
446
|
+
assert_equal 0, HighLine::Style(:black).blue # Probably reliable
|
447
|
+
assert_equal 255, HighLine::Style(:bright_blue).blue # Probably reliable
|
448
|
+
assert_equal 255, HighLine::Style(:on_none).blue # Probably reliable
|
449
|
+
end
|
450
|
+
|
451
|
+
def test_builtin
|
452
|
+
assert HighLine::Style(:red).builtin
|
453
|
+
assert !@style1.builtin
|
454
|
+
end
|
455
|
+
|
456
|
+
def test_variant
|
457
|
+
style1_name = @style1.name
|
458
|
+
style1_code = @style1.code
|
459
|
+
style1_rgb = @style1.rgb
|
460
|
+
|
461
|
+
s1 = @style1.variant(:new_foo1, :code=>'abracadabra')
|
462
|
+
assert_instance_of HighLine::Style, s1
|
463
|
+
assert_not_same @style1, s1 # This is a copy
|
464
|
+
assert_equal :new_foo1, s1.name # Changed
|
465
|
+
assert_equal 'abracadabra', s1.code # Changed
|
466
|
+
assert_equal [1,2,3], s1.rgb # Unchanged
|
467
|
+
|
468
|
+
s2 = @style1.variant(:new_foo2, :increment=>-15)
|
469
|
+
assert_instance_of HighLine::Style, s2
|
470
|
+
assert_not_same @style1, s2 # This is a copy
|
471
|
+
assert_equal :new_foo2, s2.name # Changed
|
472
|
+
assert_equal "\e[84m", s2.code # 99 (original code) - 15
|
473
|
+
assert_equal [1,2,3], s2.rgb # Unchanged
|
474
|
+
|
475
|
+
s3 = @style1.variant(:new_foo3, :code=>"\e[55m", :increment=>15)
|
476
|
+
assert_instance_of HighLine::Style, s3
|
477
|
+
assert_not_same @style1, s3 # This is a copy
|
478
|
+
assert_equal :new_foo3, s3.name # Changed
|
479
|
+
assert_equal "\e[70m", s3.code # 99 (new code) + 15
|
480
|
+
assert_equal [1,2,3], s3.rgb # Unchanged
|
481
|
+
|
482
|
+
s4 = @style1.variant(:new_foo4, :code=>"\e[55m", :increment=>15, :rgb=>"blah")
|
483
|
+
assert_instance_of HighLine::Style, s4
|
484
|
+
assert_not_same @style1, s4 # This is a copy
|
485
|
+
assert_equal :new_foo4, s4.name # Changed
|
486
|
+
assert_equal "\e[70m", s4.code # 99 (new code) + 15
|
487
|
+
assert_equal 'blah', s4.rgb # Changed
|
488
|
+
|
489
|
+
s5 = @style1.variant(:new_foo5)
|
490
|
+
assert_instance_of HighLine::Style, s5
|
491
|
+
assert_not_same @style1, s5 # This is a copy
|
492
|
+
assert_equal :new_foo5, s5.name # Changed
|
493
|
+
assert_equal "\e[99m", s5.code # Unchanged
|
494
|
+
assert_equal [1,2,3], s5.rgb # Unchanged
|
495
|
+
|
496
|
+
# No @style1's have been harmed in the running of this test
|
497
|
+
assert_equal style1_name, @style1.name
|
498
|
+
assert_equal style1_code, @style1.code
|
499
|
+
assert_equal style1_rgb, @style1.rgb
|
500
|
+
|
501
|
+
assert_raise(::RuntimeError) { @style3.variant(:new_foo6) } # Can't create a variant of a list style
|
502
|
+
end
|
503
|
+
|
504
|
+
def test_on
|
505
|
+
style1_name = @style1.name
|
506
|
+
style1_code = @style1.code
|
507
|
+
style1_rgb = @style1.rgb
|
508
|
+
|
509
|
+
s1 = @style1.on
|
510
|
+
assert_instance_of HighLine::Style, s1
|
511
|
+
assert_not_same @style1, s1 # This is a copy
|
512
|
+
assert_equal :on_foo, s1.name # Changed
|
513
|
+
assert_equal "\e[109m", s1.code # Changed
|
514
|
+
assert_equal [1,2,3], s1.rgb # Unchanged
|
515
|
+
|
516
|
+
# No @style1's have been harmed in the running of this test
|
517
|
+
assert_equal style1_name, @style1.name
|
518
|
+
assert_equal style1_code, @style1.code
|
519
|
+
assert_equal style1_rgb, @style1.rgb
|
520
|
+
|
521
|
+
assert_raise(::RuntimeError) { @style3.on } # Can't create a variant of a list style
|
522
|
+
end
|
523
|
+
|
524
|
+
def test_bright
|
525
|
+
style1_name = @style1.name
|
526
|
+
style1_code = @style1.code
|
527
|
+
style1_rgb = @style1.rgb
|
528
|
+
|
529
|
+
s1 = @style1.bright
|
530
|
+
assert_instance_of HighLine::Style, s1
|
531
|
+
assert_not_same @style1, s1 # This is a copy
|
532
|
+
assert_equal :bright_foo, s1.name # Changed
|
533
|
+
assert_equal "\e[159m", s1.code # Changed
|
534
|
+
assert_equal [129,130,131], s1.rgb # Changed
|
535
|
+
|
536
|
+
# No @style1's have been harmed in the running of this test
|
537
|
+
assert_equal style1_name, @style1.name
|
538
|
+
assert_equal style1_code, @style1.code
|
539
|
+
assert_equal style1_rgb, @style1.rgb
|
540
|
+
|
541
|
+
s2_base = HighLine::Style.new(:name=>:leia, :code=>"\e[92m", :rgb=>[0,0,14])
|
542
|
+
s2 = s2_base.bright
|
543
|
+
assert_instance_of HighLine::Style, s2
|
544
|
+
assert_not_same s2_base, s2 # This is a copy
|
545
|
+
assert_equal :bright_leia, s2.name # Changed
|
546
|
+
assert_equal "\e[152m", s2.code # Changed
|
547
|
+
assert_equal [0,0,142], s2.rgb # Changed
|
548
|
+
|
549
|
+
s3_base = HighLine::Style.new(:name=>:luke, :code=>"\e[93m", :rgb=>[20,21,0])
|
550
|
+
s3 = s3_base.bright
|
551
|
+
assert_instance_of HighLine::Style, s3
|
552
|
+
assert_not_same s3_base, s3 # This is a copy
|
553
|
+
assert_equal :bright_luke, s3.name # Changed
|
554
|
+
assert_equal "\e[153m", s3.code # Changed
|
555
|
+
assert_equal [148,149,0], s3.rgb # Changed
|
556
|
+
|
557
|
+
s4_base = HighLine::Style.new(:name=>:r2d2, :code=>"\e[94m", :rgb=>[0,0,0])
|
558
|
+
s4 = s4_base.bright
|
559
|
+
assert_instance_of HighLine::Style, s4
|
560
|
+
assert_not_same s4_base, s4 # This is a copy
|
561
|
+
assert_equal :bright_r2d2, s4.name # Changed
|
562
|
+
assert_equal "\e[154m", s4.code # Changed
|
563
|
+
assert_equal [128,128,128], s4.rgb # Changed; special case
|
564
|
+
|
565
|
+
assert_raise(::RuntimeError) { @style3.bright } # Can't create a variant of a list style
|
566
|
+
end
|
567
|
+
|
568
|
+
def test_light_do_the_same_as_bright
|
569
|
+
bright_style = @style1.bright
|
570
|
+
light_style = @style1.light
|
571
|
+
|
572
|
+
assert_not_equal bright_style, light_style
|
573
|
+
assert_equal :bright_foo, bright_style.name
|
574
|
+
assert_equal :light_foo, light_style.name
|
575
|
+
assert_equal bright_style.code, light_style.code
|
576
|
+
assert_equal bright_style.rgb, light_style.rgb
|
577
|
+
end
|
578
|
+
end
|