1
0
Fork 0
mirror of https://github.com/pry/pry.git synced 2022-11-09 12:35:05 -05:00
pry--pry/test
Kyrylo Silin 367e076670 Change behavior of cd - command
Since banister begged me to do that... completely rewrite `cd -`
command (implemetation is much simpler now).

This commit brings such changes:

  * completely rewrite behavior of `cd -` command;

  * implement ScratchPad aka Pad for unit testing purposes (by
    banister);

  * use Pad riches in the unit tests for `cd -` command;

  * remove verbose and clunky unit tests;

This commit brings new meaning to the `cd -` command. The main
difference is that the new command saves entire binding stack, not just
the last binding. Let me show you an example of the variance between
these two implemetations:

  * Old `cd -` implementation saves *only* last binding. With our next
    `cd -` invocation our interjacent results are lost:
      [1] pry(main)> cd 1/2/3/../4
      [2] pry(4):3> cd -
      [3] pry(main)> cd -
      [4] pry(4):1> nesting
      Nesting status:
      --
      0. main (Pry top level)
      1. 4

      Also, there are a few bugs in old `cd -` command:

        * you type `cd :foo`, `cd 1/2/3` and `cd -`. The last command
          relocates you to the scope of `3` (leaves you where you was),
          when `:foo` is expected;

        * you type `cd :foo`, `cd 1/2/3/../4`, `cd -`. The last command
          relocates you to the scope of `3`, when `:foo` is expected.

  * New and shiny `cd -` is devoid of those shortcomings:
      [1] pry(main)> cd 1/2/3/../4
      [2] pry(4):3> cd -
      [3] pry(main)> cd -
      [4] pry(4):3> nesting
      Nesting status:
      --
      0. main (Pry top level)
      1. 1
      2. 2
      3. 4

As I said before, this solution is *much* simpler and less error-prone.

Signed-off-by: Kyrylo Silin <kyrylosilin@gmail.com>
2012-06-27 14:54:07 +03:00
..
test_default_commands Change behavior of cd - command 2012-06-27 14:54:07 +03:00
candidate_helper1.rb added tests for module candidate API 2012-06-23 20:14:10 +12:00
candidate_helper2.rb added tests for module candidate API 2012-06-23 20:14:10 +12:00
helper.rb Change behavior of cd - command 2012-06-27 14:54:07 +03:00
test_cli.rb
test_code.rb Fix whereami inside __binding_impl__ 2012-06-10 23:42:15 -07:00
test_command.rb Fix whereami with tests, closes #595 2012-06-16 01:25:07 +12:00
test_command_helpers.rb
test_command_integration.rb Tidy up tests and remove some repeating code 2012-06-11 19:33:04 +02:00
test_command_set.rb
test_completion.rb Manually merged branch "issue/601". 2012-06-19 15:47:52 +02:00
test_control_d_handler.rb Add unit tests for DEFAULT_CONTROL_D_HANDLER 2012-06-17 11:25:33 +12:00
test_exception_whitelist.rb Tidy up tests and remove some repeating code 2012-06-11 19:33:04 +02:00
test_history_array.rb
test_hooks.rb added before_eval hook & tests 2012-06-24 01:48:11 +12:00
test_indent.rb Don't indent inside strings. [Fixes #535] 2012-04-22 01:20:38 -07:00
test_input_stack.rb Tidy up tests and remove some repeating code 2012-06-11 19:33:04 +02:00
test_method.rb Fix show-source and show-doc on __binding__/__binding_impl__ 2012-06-10 23:42:14 -07:00
test_pry.rb Tidy up tests and remove some repeating code 2012-06-11 19:33:04 +02:00
test_pry_defaults.rb Eliminate test failure 2012-06-26 22:34:13 -07:00
test_pry_history.rb
test_pry_output.rb
test_sticky_locals.rb
test_syntax_checking.rb Tidy up tests and remove some repeating code 2012-06-11 19:33:04 +02:00
test_wrapped_module.rb more tightly spec WrappedModule, and ensure WM#source_location doesn't raise 2012-06-25 04:04:43 +12:00
testrc
testrcbad