summaryrefslogtreecommitdiff
path: root/test/ruby/test_dir.rb
AgeCommit message (Collapse)Author
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
2016-02-17* test/ruby/test_dir.rb (TestDir#test_empty?): fix a platform dependent test.usa
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53857 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-02-16dir.c: Dir.empty?nobu
* dir.c (rb_dir_s_empty_p): add Dir.empty? method, which tells the argument is the name of an empty directory. [Feature #10121] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53841 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-12-16Add frozen_string_literal: false for all filesnaruse
When you change this to true, you may need to add more tests. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53141 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-10-22dir.c: glob brace expansion [Fix GH-1061]nobu
* dir.c (ruby_brace_expand): glob brace expansion edge case fix. When there are closing braces '}' before a open brace '{' it must be ignored and considered as literal. [ruby-core:71138] [Bug #11609] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52212 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-09-17* test/ruby/test_dir.rb (TestDir#test_fileno): s/?x/"x"/. Don'tkosaki
use tricky code, please. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51886 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-08-28test: File.symlink needs administrator privilegenobu
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51714 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-06-17* include/ruby/ruby.h: $SAFE=3 is now obsolete.hsbt
* ext/socket/init.c, ext/socket/socket.c, ext/socket/tcpsocket.c ext/socket/udpsocket.c, gc.c, object.c, re.c, safe.c: removed code for $SAFE=3 * bootstraptest/test_method.rb, test/erb/test_erb.rb, test/ruby/test_dir.rb test/ruby/test_file.rb, test/ruby/test_method.rb, test/ruby/test_regexp.rb test/ruby/test_thread.rb: remove tests for $SAFE=3 git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@50932 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-06-03dir.c: FNM_SHORTNAMEnobu
* dir.c (dirent_match): match short names only when FNM_SHORTNAME flag is given, for the backward compatibility, and the new behavior is often dangerous. [ruby-core:69435] [Bug #11206] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@50760 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-04-01test_dir.rb: recursive globbingnobu
* test/ruby/test_dir.rb (test_symlink): add an assertion for recursive globbing. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@50146 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-03-31test_dir.rb: assert_entriesnobu
* test/ruby/test_dir.rb (assert_entries): extract common assertinos for Dir.entries and Dir#foreach. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@50139 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-03-31test_dir.rb: test_entriesnobu
* test/ruby/test_dir.rb (test_entries): test for Dir#entries. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@50138 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-03-31test_dir.rb: fix arguments ordernobu
* test/ruby/test_dir.rb (test_foreach): fix arguments order, the expected result should be first. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@50137 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-03-23dir.c: don't raise after closenobu
* dir.c (dir_close): don't raise on dobule close for consistent to IO#close. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@50064 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-03-08dir.c: glob short namesnobu
* dir.c (glob_helper): match patterns against legacy short names too, not only ordinary names. [ruby-core:67954] [Bug #10819] * win32/dir.h (struct direct): add short name members. * win32/win32.c (opendir_internal, readdir_internal): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@49892 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-02-03dir.c: glob legacy short namenobu
* dir.c (glob_helper): obtain real name with FindFirstFile API instead of matchin all entries, on Windows. [ruby-core:67954] [Bug #10819] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@49478 b2dd03c8-39d4-4d8f-98ff-823fe69b080e