summaryrefslogtreecommitdiff
path: root/spec
Commit message (Collapse)AuthorAgeFilesLines
* Complete Style/SymbolArray todoDouglas Eichelberger2022-09-112-10/+10
|
* Merge pull request #2239 from andrehjr/drop-ruby-1-9-3André Luis Leal Cardoso Junior2022-06-115-26/+8
|\ | | | | Drop support for Ruby 1.9.x
| * Remove more 1.9 related workaroundsAndré Luis Leal Cardoso Junior2022-03-102-4/+1
| |
| * Support jruby >= 9.0.0André Luis Leal Cardoso Junior2022-03-101-8/+5
| |
| * Remove support for Ruby 1.9.3André Luis Leal Cardoso Junior2022-03-102-14/+2
| |
* | Merge pull request #2235 from pry/revert-2154-patch-1André Luis Leal Cardoso Junior2022-04-211-19/+19
|\ \ | | | | | | Revert "Escape non-printing characters"
| * | Revert "Escape non-printing characters"André Luis Leal Cardoso Junior2022-03-061-19/+19
| | |
* | | Fix ruby 1.9 buildAndré Luis Leal Cardoso Junior2022-04-091-1/+1
| | |
* | | Fix rubocop warningsAndré Luis Leal Cardoso Junior2022-04-092-5/+7
| | |
* | | Weird method location shouldn't match unknown locationJames Coleman2022-04-092-0/+41
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Methods that don't have a source location (e.g., C methods, or methods created via metaprogramming or even `alias_method` to C methods) are not reasonable possible matching methods for a "weird method" we need to locate. In this case `renamed_method_source_location` can also return `nil` if the actual code in question is a bare script (i.e., no methods). If that script is loaded via `eval` then we'll end up in the weird method path in the first place, but no method matching can be found, and if a no-source-location method exists, we'll return that. Down the line that's particularly painful because the source loading thinks it's a C method, but it can actually be from metaprogramming (and `alias_method`!), and then `Pry::Method#pry_doc_info` raises an error, and `wherami` breaks even though we already have valid `__FILE__` and `__LINE__` values.
* | | As readline is being lazy required it throws an error when it gets resolved ↵André Luis Leal Cardoso Junior2022-03-091-0/+1
| |/ |/| | | | | inside the trap signal
* | Remove extra commentsAndré Luis Leal Cardoso Junior2022-03-052-4/+0
| |
* | Skip spec/pry_repl_spec.rb spec on windowsAndré Luis Leal Cardoso Junior2022-03-051-0/+1
| |
* | Fix Pry::History specs on windowsAndré Luis Leal Cardoso Junior2022-03-052-8/+13
| | | | | | | | Co-Authored-by: SilverPhoenix99 <silver.phoenix99@gmail.com>
* | Ensure files are not shell escaped on windows testsAndré Luis Leal Cardoso Junior2022-03-051-1/+5
| |
* | Fix Pry::Editor specs on windowsAndré Luis Leal Cardoso Junior2022-03-051-0/+1
| |
* | Fix spec/integration/cli_spec.rb for windowsAndré Luis Leal Cardoso Junior2022-03-051-23/+34
| | | | | | | | | | | | Cherry-picked file changes from 7c08e24dba0d47ad09288613c834507575bba7e9 Co-Authored-by: SilverPhoenix99 <silver.phoenix99@gmail.com>
* | Fix rubocop offenseAndré Luis Leal Cardoso Junior2022-03-051-1/+1
| |
* | Build expected_path properly for other platformsAndré Luis Leal Cardoso Junior2022-03-051-3/+6
| |
* | Unit test fix: skip tests for signal USR1 in Windows.SilverPhoenix992022-03-051-0/+4
|/
* fix pry indent frozen error (#2136)T.Yasuma2021-10-111-0/+8
| | | | | | | | | * fix pry indent frozen error * fix generation of mutable strings * fix String.new with no argument * rubocop: fix offences of the Style/EmptyLiteral cop
* Fix failing build on 2.4 & 2.5Kyrylo Silin2021-07-091-5/+0
| | | | | | | | | | | | Example failure: https://github.com/pry/pry/runs/3010680604 ``` ArgumentError: wrong number of arguments (given 4, expected 1) /home/runner/work/pry/pry/vendor/bundle/ruby/2.4.0/gems/psych-4.0.1/lib/psych.rb:323:in `safe_load' ``` I am not sure what exactly causes the failure but deleting simplecov dependency fixes (I guess?) this problem.
* Return with an error message if pry is started inside signal handler (#2206)Barrett Ingram2021-07-031-0/+25
| | | | | | | | | | | | | | | | Mutex#synchronize will throw an error if called from code passed to Signal.trap. This makes it impossible to start a working Pry session inside a signal handler. Currently, calling binding.pry inside signal handling code raises an exception because Pry uses mutexes to solve various thread-safety issues. This commit updates Pry.start to detect whether we'll have the ability to use Mutex#synchronize. If not, we'll print an error message and return instead of raising an error. https://github.com/pry/pry/issues/2191
* validates file presence in Config#default_rc_file (#2129)Armin2021-07-011-8/+40
| | | | | | | | * validates file presence in Config#default_rc_file Return `nil` if no default rc file is present in the filesystem. This fixes the behavior if $XDG_CONFIG_HOME is set, but no rc file at the path `$XDG_CONFIG_HOME/pry/pryrc` (while it may be at `~/.pryrc`).
* ring: change guard priority so that the value at index can be readKyrylo Silin2021-06-281-1/+3
| | | | Fixes #2199 (`_out_` Ring is ill-addressible)
* helpers/documentation: don't colorize twiceKyrylo Silin2021-04-111-0/+4
| | | | | | | Fixes #2181 (Bad formatting) One of the regexps matches against string that were already colored. To prevent that I used a negative look-ahead and rejected color sequences.
* Merge pull request #2158 from andrehjr/fix-color-off-overwriteKyrylo Silin2021-03-282-1/+19
|\ | | | | Fix breakage in output with colors disabled
| * Fix RegexpError: premature end of char-classAndré Luis Leal Cardoso Junior2020-10-051-1/+1
| |
| * Make #strip_color only remove colors.André Luis Leal Cardoso Junior2020-10-051-0/+18
| | | | | | | | The previous implementation was removing more than that. When Pry.color = false, it was messing up the output of a few commands.
* | Merge pull request #2154 from xjunior/patch-1Kyrylo Silin2021-03-281-19/+19
|\ \ | | | | | | Escape non-printing characters
| * | Update Wtf spec to match non-printing chars wrappingCarlos Palhares2020-09-071-19/+19
| |/
* | Add CI support for ruby 3 and fix broken specBarrett Ingram2021-01-021-1/+1
| | | | | | | | | | | | | | Spec started failing because a statement which we expected to be a syntax error is now interpreted as a valid pattern-matching statement. Swapping the hash-rockets for colons turns this back into a syntax error.
* | Merge pull request #2140 from utkarsh2102/fix-bundler_spec-testKyrylo Silin2020-11-281-1/+2
|\ \ | | | | | | Fix bundler_spec test
| * | Fix bundler_spec testUtkarsh Gupta2020-06-161-1/+2
| |/ | | | | | | Signed-off-by: Utkarsh Gupta <utkarsh@debian.org>
* | Merge pull request #2119 from mvz/issue-1241-remove-autoloading-of-pluginsKyrylo Silin2020-11-282-16/+0
|\ \ | |/ |/| Remove autoloading of plugins
| * Remove plugin system in favor of regular requiresMatijs van Zuijlen2020-03-221-15/+0
| |
| * Remove should_load_plugins config optionMatijs van Zuijlen2020-03-221-1/+0
| |
* | Merge pull request #2122 from ahorek/frozen_pry_bugKyrylo Silin2020-04-121-0/+12
|\ \ | | | | | | pry-backtrace frozen bug
| * | pry-backtrace frozen bugpavel2020-03-251-0/+12
| |/
* | Merge pull request #2120 from barrettkingram/fix-help-command-listingKyrylo Silin2020-04-121-1/+6
|\ \ | | | | | | Improve appearance of help command listing
| * | Improve help listing for regex aliasesBarrett Ingram2020-03-221-1/+6
| |/ | | | | | | | | | | | | | | | | | | This commit improves the appearance of regex aliases in the help index by storing the result of calling #inspect on the regex as the listing. For example, consider the `whereami` alias `/whereami[!?]+/`. Previously this would appear in the help index as `(?-mix:whereami[!?]+)`. This commit fixes this so it appears as `/whereami[!?]+/`.
* | config: return `nil` on unknown option instead of raisingKyrylo Silin2020-04-121-2/+2
|/ | | | | | | | | | | | | | | | Returning `nil` on unknown option was default behaviour for Pry v0.12.x. In e5556a2be8627ec3fe594c738f10422d5a1f5d43 I changed that but I am not sure if it was intentional. This breaks plugins such as pry-theme (https://github.com/kyrylo/pry-theme/issues/59). Returning `nil` makes more sense, because we can write code like this: ``` Pry.config.foo ||= 123 ``` ...whereas as of now this is no longer possible and you would need to use `respond_to?` to achieve the same effect.
* Display all syntax error messages when catching SyntaxExceptionBarrett Ingram2020-03-211-5/+23
| | | | | | | | | | | | | | | | | | | | | | | Previously when catching syntax errors in the REPL, we were only showing the last syntax error displayed by the ruby output. However, ruby can generate multiple syntax error messages within a single SyntaxException. For example, this code generates multiple syntax error messages: ``` $ ruby -e 'puts {"key"=>"val"}.to_json' -e:1: syntax error, unexpected =>, expecting '}' puts {"key"=>"val"}.to_json -e:1: syntax error, unexpected '}', expecting end-of-input puts {"key"=>"val"}.to_json ``` We can't predict which error message would be most helpful for the consumer - we should show both of them. This commit modifies the string replacement we're doing when printing SyntaxExceptions so any number of syntax error lines will be shown correctly. Issue: https://github.com/pry/pry/issues/2102 The error message of SyntaxError is different from Ruby's one
* method: delegate internally-used methodsKyrylo Silin2020-03-211-0/+63
| | | | | | | | | | | | | | | | | | | Improves on #2086 (Directly delegate internally-used Method methods) (we add tests here) Description by @michaelherold > Relying on `method_missing` for all delegation to `Method` methods means > that it's easier for the wrong method to be called when gems mess with > `Object` or other such core areas. > See https://github.com/ankane/ownership/pull/3 for an example of this. > By defining explicit delegators, at least for the methods that we use > internally withing Pry, we can eliminate this issue and be more > communicative around the methods on the `Pry::Method` class. I omitted the `source_location` changes because they need some clarification.
* spec/integration/bundler: fix the "no dependencies" warningKyrylo Silin2020-03-211-0/+6
| | | | | | | | Fixes the following warning: ``` The Gemfile specifies no dependencies ```
* Fix completion_spec on MRI 2.7.0Jean Boussier2020-03-201-1/+1
| | | | | | | | | | | | | | | | | | The spec was failing because on 2.7 hash directly return nil without hashing the key if they are empty: ```ruby m = Module.new do def self.hash; end end h = {} h[m] # => nil h[1] = 2 h[m] # => ArgumentError ``` So we need to require IRB so that the to_ignore set isn't empty
* Fix whereami -c when class definition is not beginning of lineBarrett Ingram2019-12-291-0/+11
| | | | | | | | | | | | | | | | | | Consider the following class definition: ``` out = class Cor def blimey; end pry_eval(binding, 'whereami -c') end ``` For classes defined as part of an expression like this, "whereami -c" was failing to find the class definition. To fix this, we modify the regular expression so the "class" keyword is no longer required to appear at the beginning of the line IF there is an equals sign preceding it. https://github.com/pry/pry/issues/2052
* Allow negative ranges in hist --showBrian Graham2019-08-091-0/+9
| | | | Remove duplicate `opts[:show]` check in hist.
* Attempt to allow pasting multiple lines with leading dots (#2060)Josh Cheek2019-07-112-4/+4
| | | | | | Two tests are breaking, and I kind of understand why, but I'm not sure what to do about it. Figured I should commit and send a PR in hopes of another brain being able to help me out :)
* spec/commands/show_source: pass binding to pry_eval to fix failuresKyrylo Silin2019-06-151-26/+20
| | | | | | | There are sporadic failures with some of the tests (seems to be isolated to the code that uses `Pry.config.commands`). Passing `binding` to `pry_eval` seems to be fixing them. To be quite fair, I'm not sure why that happens but it feels like the right fix because we do the same in many other tests.