# vim:ts=2:sw=2:et: #------------------------------------------------------------------------------- # Copyright (c) 1997-2014, Perforce Software, Inc. All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are met: # # 1. Redistributions of source code must retain the above copyright # notice, this list of conditions and the following disclaimer. # # 2. Redistributions in binary form must reproduce the above copyright # notice, this list of conditions and the following disclaimer in the # documentation and/or other materials provided with the distribution. # # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS # FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL PERFORCE # SOFTWARE, INC. BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON # ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR # TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF # THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH # DAMAGE. #------------------------------------------------------------------------------- require 'rbconfig' class TC_Enviro < Test::Unit::TestCase include P4RubyTest def name 'Test client environment' end def test_enviro assert(p4, 'Failed to create Perforce client') set_supported = !((RbConfig::CONFIG['target_os'].downcase =~ /mswin|mingw|darwin/).nil?) if !p4.env('P4DESCRIPTION') && set_supported assert(p4.set_env('P4DESCRIPTION', 'foo'), 'Cannot set P4DESCRIPTION in registry') assert_equal('foo', p4.env('P4DESCRIPTION')) assert(p4.set_env('P4DESCRIPTION', ''), 'Cannot clear P4DESCRIPTION from registry') end p4.user = 'tony' p4.client = 'myworkstation' p4.port = 'myserver:1666' p4.password = 'mypass' p4.prog = 'somescript' p4.version = '2007.3/12345' assert_equal(p4.user, 'tony') assert_equal(p4.client, 'myworkstation') assert_equal(p4.port, 'myserver:1666') assert_equal(p4.password, 'mypass') assert_equal(p4.prog, 'somescript') assert_equal(p4.version, '2007.3/12345') p4.enviro_file = '/tmp/enviro_file' assert_equal(p4.enviro_file, '/tmp/enviro_file') end end
# | Change | User | Description | Committed | |
---|---|---|---|---|---|
#1 | 16213 | perforce_software | Move files to proper depot path to view files correctly from project page. | ||
//guest/perforce_software/p4ruby/r15.1/test/02_environment_test.rb | |||||
#1 | 14759 | tjuricek |
p4ruby 2015.1.0 This will be a source gem targeted at Linux. Windows support will come after automated builds of the C++ p4api are available for MinGW-w64. For more information, please review the workshop project: https://swarm.workshop.perforce.com/projects/perforce-software-p4ruby/ |
||
//guest/perforce_software/p4ruby/p15.1/test/02_environment_test.rb | |||||
#1 | 14756 | tjuricek | p15.1 branch of p4ruby. | ||
//guest/perforce_software/p4ruby/main/test/02_environment_test.rb | |||||
#6 | 14705 | tjuricek |
Merge branch 'master' of gfprod:p4ruby-check Conflicts: test/02_environment_test.rb test/98_unicode_test.rb Imported from Git Author: Tristan Juricek <tjuricek@perforce.com> 1421272022 -0800 Committer: Tristan Juricek <tjuricek@perforce.com> 1421272022 -0800 sha1: 2a9e62acaaca876c3fd04cd3ea1c3228003885e2 push-state: complete parent-changes: cab72389a4abd47d0ec2f148592ad0f640ec1c6b=[969219]/2950fbb70d4b00f06d1bf6a5474b0451e172a358=[985877] |
||
#5 | 14694 | tjuricek |
Add `enviro_file` property to `P4` object that calls SetEnviroFile and GetEnviroFile underneath. P4RUBY-169 Imported from Git Author: Tristan Juricek <tjuricek@perforce.com> 1418331105 -0800 Committer: Tristan Juricek <tjuricek@perforce.com> 1418331105 -0800 sha1: 141f8b9f65b4c56ce5a42144d8c185285effaa12 push-state: complete parent-changes: 98f9b10c0c37b44bfc8659e7934440fe1252c4c2=[974326] |
||
#4 | 14685 | tjuricek |
First merge into main of the p4ruby-check project, used to validate the p4ruby gem (without any access to source). This does require using p4util: bundle exec p4util download p4d See tools/test_p4ruby_gem.sh for the exact process used to validate the gem. Imported from Git Author: Tristan Juricek <tjuricek@perforce.com> 1415838551 -0800 Committer: Tristan Juricek <tjuricek@perforce.com> 1415838551 -0800 sha1: bc41f30d8c51a652defeee59f438d1446091ee61 push-state: complete parent-changes: 97f4a83740ecd006070c19775bd9a3abba2f9804=[946222]/1256d8281e6fbfe9f2019fd3756d0b4730beb5c5=[960938] |
||
#3 | 14684 | Git Fusion |
Git Fusion branch management Imported from Git ghost-of-change-num: 946222 ghost-of-sha1: 97f4a83740ecd006070c19775bd9a3abba2f9804 ghost-precedes-sha1: bc41f30d8c51a652defeee59f438d1446091ee61 push-state: incomplete |
||
#2 | 14682 | Git Fusion |
Git Fusion branch management Imported from Git ghost-of-change-num: 960958 ghost-of-sha1: 005052ae424bd69f426f7209e741ca1c8c3253c7 ghost-precedes-sha1: ad052c71a568ef12165e143a6866ad9ceffbb4a1 parent-branch: None@960958 push-state: incomplete |
||
#1 | 14676 | tony |
Rework P4Ruby unit tests so they they are actually units. Now the test order is irrelevant as all tests are standalone. Tidied up the code formatting as well and removed all the tabs from the ruby sources files. Added a modeline for vim users so consistent indentation will be used. |
||
//guest/perforce_software/p4ruby/main/test/02_environment.rb | |||||
#9 | 14657 | tony |
Make P4Ruby build with Ruby 2.0.0 (on Mac at least). Mostly cosmetic changes: just makes the build script handle the Ruby 2 mkmf and the changes also work with 1.8.7 and 1.9.3 so they should probably have been like this all along. Infrastructure change only - no functional change |
||
#8 | 14637 | jmistry | Remove P4IGNORE and P4CLIENTPATH tests | ||
#7 | 14620 | jmistry | Add P4IGNORE and P4CLIENTPATH unit tests | ||
#6 | 14613 | jmistry |
Fix P4#set_env unit test Unit test incorrectly checked if the platform is Linux and skipped part of the test if it was. So, this part of the test was still running on platforms that do not support P4#set_env and would raise an (expected) exception during the unit test. Now it checks if the platform is Windows or Darwin, and if it is it runs the registry setting test. |
||
#5 | 14611 | jmistry |
Support setting values in the registry through P4Ruby. The command P4.set_env( var, val ) will set a registry variably on platforms that support this action or through an exception on Unix. The command P4.set_env( var ) resets a registry variable. Updated unit test '02_environment.rb' to include registry set/check. User visible change to be documented in release notes. |
||
#4 | 14610 | jmistry |
Fix unlink error on unit tests Wrap the connect/disconnect in begin/ensure blocks to ensure that the client disconnect even if there are failures in a unit test. Fix unicode unit test for 1.9. When the contents of a file is stored in a String object, ruby 1.9 sets the String's encoding to the current locale. This is overridden in the test case and set to the correct value. This may need to be documented. user visible change. |
||
#3 | 14522 | tony | Add copyright notices to the test files. | ||
#2 | 14500 | tony |
Add P4#version= and P4#version methods to get/set the version of the program. User-visible change to be documented in Scripting Interface Guide |
||
#1 | 14499 | tony |
Shuffle up the tests to make some room for one that tests setting and getting of client environment vars. Also give nice names to the tests while we're there. |