Hiroshi SHIBATA
d6624db926
[ruby/irb] Prefer to use File.open instead of Kernel.open
...
ed9e435a6b
2022-12-16 01:10:46 +00:00
st0012
1eae15142f
[ruby/irb] Remove duplicated TestInputMethod definitions
...
4b831d02e1
2022-11-15 10:07:32 +00:00
Stan Lo
a923203811
[ruby/irb] Provide a base test class and let tests restore encodings
...
conveniently
(https://github.com/ruby/irb/pull/429 )
* Create a base TestIRB::TestCase class
* Save/restore encodings for tests that initializes InputMethod classes
Because `RelineInputMethod#initializes` calls `set_encoding`, which
changes stdio/out/err and Encoding's default encoding values, we need to
make sure any test that directly or indirectly (e.g. through Context)
initializes `RelineInputMethod` restores encodings.
`ReadlineInputMethod` also changes encodings but currently no tests
cover it.
* Remove unnecessary TestHelper module
Since we now have a base TestCase, without_rdoc can just live there.
c2874ec121
2022-11-03 22:13:11 +00:00
Hiroshi SHIBATA
c287deecb6
backup IRBRC environmental variable. It's used by test methods when it's defined.
2022-09-21 14:25:42 +09:00
Hiroshi SHIBATA
d6e84d97fe
Fix the missing locale error
2022-09-21 14:25:42 +09:00
Nobuyoshi Nakada
752ae81ed1
[ruby/irb] Refine assertion for failures
...
fd047512b3
2022-09-15 08:25:53 +09:00
Nobuyoshi Nakada
ae2e8d364f
[ruby/irb] Dir.mktmpdir
creates a directory including the process ID
...
a15f68ffdb
2022-09-15 08:25:52 +09:00
Jeremy Evans
9299db49f5
[ruby/irb] Fix history file saving with concurrent irb sessions when history file doesn't exist
...
If history file didn't exist when irb was started, @loaded_history_mtime
would be nil. However, if the history file didn't exist before, but it
exists when saving history, that means the history file was modified,
and we should handle it the same way as we handle the other case where
the history file was modified.
Fixes #388
8d277aafcb
2022-09-14 10:15:45 +09:00
Kazuhiro NISHIYAMA
85f99f4b71
Try to fix errors in TestIRB::TestHistory too
...
2137935523 (step)
:9:562
```
1) Error:
TestIRB::TestHistory#test_history_concurrent_use:
Errno::EACCES: Permission denied @ dir_s_mkdir - /home/runner/.config/irb
/home/runner/work/actions/actions/ruby/lib/fileutils.rb:253:in `mkdir'
/home/runner/work/actions/actions/ruby/lib/fileutils.rb:253:in `fu_mkdir'
/home/runner/work/actions/actions/ruby/lib/fileutils.rb:231:in `block (2 levels) in mkdir_p'
/home/runner/work/actions/actions/ruby/lib/fileutils.rb:229:in `reverse_each'
/home/runner/work/actions/actions/ruby/lib/fileutils.rb:229:in `block in mkdir_p'
/home/runner/work/actions/actions/ruby/lib/fileutils.rb:211:in `each'
/home/runner/work/actions/actions/ruby/lib/fileutils.rb:211:in `mkdir_p'
/home/runner/work/actions/actions/ruby/lib/irb/init.rb:355:in `rc_file_generators'
/home/runner/work/actions/actions/ruby/lib/irb/init.rb:330:in `rc_file'
/home/runner/work/actions/actions/ruby/test/irb/test_history.rb:170:in `block in assert_history'
/home/runner/work/actions/actions/ruby/lib/tmpdir.rb:96:in `mktmpdir'
/home/runner/work/actions/actions/ruby/test/irb/test_history.rb:168:in `assert_history'
/home/runner/work/actions/actions/ruby/test/irb/test_history.rb:133:in `test_history_concurrent_use'
```
2021-03-18 18:07:18 +09:00
Jeremy Evans
14e1739ff3
[ruby/irb] Make save-history extension safe for concurrent use
...
This makes the save-history extension check for modifications to
the history file before saving it. If the history file was modified
after the history was loaded and before it was saved, append only
the new history lines to the history file.
This can result in more lines in the history file than SAVE_HISTORY
allows. However, that will be fixed the next time irb is run and
the history is saved.
Fixes [Bug #13654 ]
041ef53845
2021-03-06 00:18:32 +09:00
aycabta
20ad101701
Remove system method for E2E testing because depends on ruby command
2020-10-05 19:50:31 +09:00
aycabta
9718ff62c1
Show stdout and stderr when history tests fail
2020-10-05 04:17:26 +09:00
aycabta
6509652c13
Skip irb/test_history on Windows too
2020-08-20 13:24:55 +09:00
aycabta
f81811fc2f
Skip Editline for history tests of IRB
...
Because Editline erases all histories in Readline::HISTORY when
Readline.readline is called.
2020-08-19 19:15:21 +09:00
aycabta
e2c2283a80
Skip irb/test_history on Solaris
2020-08-19 13:03:32 +09:00
aycabta
e939a5c29f
Use "in" and "out" options of "system" instead of "replace_stdio"
2020-08-19 11:18:50 +09:00
aycabta
ca6868a430
Do "write" to temp stdin before "reopen"
2020-08-19 09:42:34 +09:00
Yusuke Endoh
bed6b7206a
test/irb/test_history.rb: prevent warnings
...
```
/home/chkbuild/chkbuild/tmp/build/20200818T123003Z/ruby/test/irb/test_history.rb:16:
warning: assigned but unused variable - result_output
/home/chkbuild/chkbuild/tmp/build/20200818T123003Z/ruby/test/irb/test_history.rb:34:
warning: assigned but unused variable - result_output
/home/chkbuild/chkbuild/tmp/build/20200818T123003Z/ruby/test/irb/test_history.rb:57:
warning: assigned but unused variable - result_output
/home/chkbuild/chkbuild/tmp/build/20200818T123003Z/ruby/test/irb/test_history.rb:80:
warning: assigned but unused variable - result_output
```
2020-08-18 23:32:46 +09:00
aycabta
6767a9ef2b
Lounch external process on Windows correctly
2020-08-18 21:43:19 +09:00
aycabta
01b6c520f5
[ruby/irb] Change the way the IRB is invoked as an external process
...
f4bcdf4375
2020-08-18 20:06:52 +09:00
aycabta
a388e2554c
[ruby/irb] Add require 'irb' to test separately
...
9e4423b6e1
2020-08-18 14:38:01 +09:00
aycabta
126e1fc296
[ruby/irb] Make history infinite if set SAVE_HISTORY to negative
...
824473e880
2020-08-18 14:38:01 +09:00
aycabta
ef498a016b
[ruby/irb] Suppress crash when bignum is set to SAVE_HISTORY
...
5044eb2730
2020-08-18 14:38:01 +09:00
aycabta
1359da6ec0
[ruby/irb] Add tests about IRB history
...
82efd370eb
2020-08-18 14:38:01 +09:00