summaryrefslogtreecommitdiff
path: root/test/ruby/test_dir.rb
AgeCommit message (Collapse)Author
2021-06-29Prefer qualified names under ThreadNobuyoshi Nakada
2021-06-24Actually ignore FNM_CASEFOLD flag in Dir.globJeremy Evans
This was already documented as being ignored, but it wasn't being ignored, causing an issue in a particular case where a UTF-8 pattern was provided and a filename was tested that wasn't valid UTF-8. Fixes [Bug #14456] Notes: Merged: https://github.com/ruby/ruby/pull/4583
2021-01-12Remove "." and ".." from Dir.glob with FNM_DOTMATCH [Bug #17280]Nobuyoshi Nakada
Co-authored-by: Jeremy Evans <code@jeremyevans.net> Notes: Merged: https://github.com/ruby/ruby/pull/4052
2020-12-24dir.c: chdir conflict should raise only when called in different threadYusuke Endoh
... and keep it as a warning (like 2.7) when it is called in the same thread. [Bug #15661] Notes: Merged: https://github.com/ruby/ruby/pull/3990
2020-12-17test/ruby: Check warning messages at a finer granularityNobuyoshi Nakada
Instead of suppressing all warnings wholly in each test scripts by setting `$VERBOSE` to `nil` in `setup` methods. Notes: Merged: https://github.com/ruby/ruby/pull/3925 Merged-By: nobu <nobu@ruby-lang.org>
2020-12-08Made method-local instance variables local variablesNobuyoshi Nakada
2020-09-28Switch conflicting chdir warning to RuntimeErrorJeremy Evans
The documentation already stated this was an error in one case (when it was previously a warning). Describe the other case, where chdir without block is called inside block passed to chdir. Fixes [Bug #15661] Notes: Merged: https://github.com/ruby/ruby/pull/3591
2020-04-11Assertions for basic use of `encoding:` optionNobuyoshi Nakada
Notes: Merged: https://github.com/ruby/ruby/pull/3018
2020-04-11Assertions for enumerators of DirNobuyoshi Nakada
Notes: Merged: https://github.com/ruby/ruby/pull/3018
2020-04-11Removed unnecessary `to_a` callNobuyoshi Nakada
`Dir.entries` returns an array. Notes: Merged: https://github.com/ruby/ruby/pull/3018
2020-03-25Fixed crash when argument array is modifiedNobuyoshi Nakada
2020-01-19Sort globbed results by default [Feature #8709]Nobuyoshi Nakada
Sort the results which matched single wildcard or character set in binary ascending order, unless `sort: false` is given. The order of an Array of pattern strings and braces are not affected. Notes: Merged: https://github.com/ruby/ruby/pull/2846
2020-01-18Removed useless sorts of lists generated from literalsNobuyoshi Nakada
2019-09-09Make test-all and test-spec runnable on AndroidYusuke Endoh
Calling some syscall functions such as Dir.chroot causes SIGSYS instead of EPERM on Android. This change skips all tests that stops the test-suite run.
2019-09-02Prohibit nul-separated glob pattern [Feature #14643] (#2419)Nobuyoshi Nakada
Notes: Merged-By: nobu <nobu@ruby-lang.org>
2019-03-21dir.c: fix Dir.glob starts with braceshirosaki
* dir.c (ruby_glob0): expand braces if a glob pattern starts with brace. [ruby-core:91728] [Bug #15649] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@67332 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2019-03-03do not close FSs explicitly.ko1
* test/ruby/test_dir.rb: r67159 closes all files explicitly but this change breaks attempt of this test introduced at r56467. Try another solution which removes all references from an Array with `#clear`. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@67161 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2019-03-03close opened files explicitlyko1
to fix a test failure like http://ci.rvm.jp/results/trunk-theap-asserts@silicon-docker/1804207 git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@67159 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2019-01-16dir.c: fix Dir.glob with braces and matching dirshirosaki
* dir.c (join_path_from_pattern): add the last slash for directory matching. * test/ruby/test_dir.rb (test_glob_recursive_directory): add a test for above. [ruby-core:91110] [Bug #15540] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@66838 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-11-24Fix r65926 test_dir.rb for windows (tilde)k0kubun
[Fix GH-2022] From: MSP-Greg <greg.mpls@gmail.com> git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@65943 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-11-23split each assert_nothing_raisednobu
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@65932 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-11-22Use File.expand_path("~username") instead of ENV["HOME"]naruse
File.expand_path("~username") uses getpwnam() independently from Dir.home. [Bug #15324] From: Chris Seaton <chris@chrisseaton.com> git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@65926 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-07-09dir.c: fix directory globnobu
* dir.c (glob_helper): fix directory glob which resulted in lacking the first byte. adjust the length of basename to be appended as well as removing the heading path, not the length of the joined path. [ruby-dev:50588] [Bug #14899] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63909 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-04-19dir.c: warning for NULnobu
* dir.c (rb_push_glob): warn NUL-separated glob patterns. [Feature #14643] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63190 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-03-28dir.c: check NUL bytesnobu
* dir.c (GlobPathValue): should be used in rb_push_glob only. other methods should use FilePathValue. https://hackerone.com/reports/302338 * dir.c (rb_push_glob): expand GlobPathValue git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62989 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-01-24dir.c: Dir#each_childnobu
* dir.c (dir_each_child_m): new instance methods Dir#each_child and Dir#children. [Feature #13969] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62022 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-10-27Revert "Dir.glob with FNM_EXTGLOB is optimized [Feature #13873]"naruse
This reverts commit r60341,r60342,r60344,r60345. Breaking compabitility of the order of result breaks many tests. To avoid such effort to fix tests, the order should be kept. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60478 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-10-22sort test resultnaruse
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60344 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-10-22sort the test resultnaruse
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60342 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-10-22Dir.glob with FNM_EXTGLOB is optimized [Feature #13873]naruse
The order of resulted array is changed in some cases. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60341 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-10-21Revert "ignore server side error"naruse
This reverts commit r60314. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60315 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-10-21ignore server side errornaruse
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60314 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-10-21Revert "Dir.glob with FNM_EXTGLOB is optimized [Feature #13873]"naruse
This reverts commit r60253 because it causes on error on Linux. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60255 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-10-21Dir.glob with FNM_EXTGLOB is optimized [Feature #13873]naruse
The order of resulted array is changed in some cases. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60253 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-08-03Use the same variable name as in dir.ckazu
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59487 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-08-03dir.c: relative path Dir basenobu
* dir.c (glob_helper): fix globbing based on a relative path Dir. [Feature #13056] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59479 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-08-03dir.c: relax base optionnobu
* dir.c (dir_glob_options): relax base option. ignore when nil or an empty string as :base option. [Feature #13056] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59476 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-05-26dir.c: yield without base partnobu
* dir.c (glob_helper): yield globbed part only without the base directory path part if the base is given. [Feature#13056] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58901 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-05-25dir.c: Dir.each_child and Dir.childrennobu
* dir.c (dir_s_each_child, dir_s_children): Dir.each_child and Dir.children which are similar to Dir.foreach and Dir.entries respectively, except to exclude "." and "..". [Feature #11302] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58879 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-05-25test_dir.rb: test Dir.entriesnobu
* test/ruby/test_dir.rb (test_entries): test class singleton method Dir.entries too. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58878 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-05-23Dir as base optionnobu
* dir.c (glob_helper): support Dir instance as `base` option. [Feature#13056] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58860 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-05-23test_dir.rb: sortnobu
* test/ruby/test_dir.rb (test_glob_base): sort the globbed result to compare. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58859 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-05-23Dir.glob base optionnobu
* dir.c (dir_s_aref, dir_s_glob): add new optional keyword argument, `base`. [Feature#13056] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58858 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-03-27dir.c: err at glob failurenobu
* dir.c (glob_helper): raise a SystemCallError exception when opendir() failed, except for ENOENT, ENOTDIR, and EACCES. this behavior predates 1.0; the comments in glob.c claimed that glob() returned -1 on error but actualy the pointer to a global variable, then dir_glob() did check only -1 as the comments, and ignored actual errors. [ruby-core:80226] [Bug #13276] dir.c: ruby_glob_funcs_t git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58156 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-11-26file.c: home directory from systemnobu
* file.c (rb_default_home_dir): resolve home directory from the system database when HOME is not set. [Feature #12695] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56902 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-10-21fix r56467nobu
* test/ruby/test_dir.rb (test_glob_gc_for_fd): needs RLIMIT_NOFILE. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56468 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-10-21dir.c: retry glob with GCnobu
* dir.c (do_opendir): retry after GC when the limit for open file descriptors reached. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56467 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-05-08file.c: home dir fall backnobu
* file.c (rb_home_dir_of): return the default home path if the user name is the current user name, on platforms where struct pwd is not supported. a temporary measure against [Bug #12226]. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54947 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-02-17test_dir.rb: Dir.empty? with directoriesnobu
* test/ruby/test_dir.rb (test_empty): check with directories. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53862 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-02-17test_dir.rb: Dir.empty? with dot filenobu
* test/ruby/test_dir.rb (test_empty): check with a dot file. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53861 b2dd03c8-39d4-4d8f-98ff-823fe69b080e