From 246800d42bf1cb6d2031491ebb26c999b19ddeea Mon Sep 17 00:00:00 2001 From: nobu Date: Thu, 13 Feb 2003 09:58:57 +0000 Subject: [PATCH] *** empty log message *** git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@3493 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- eval.c | 16 ++++++++-------- file.c | 1 - sample/test.rb | 7 +++++++ 3 files changed, 15 insertions(+), 9 deletions(-) diff --git a/eval.c b/eval.c index 56e9db8170..ff1eeb59bf 100644 --- a/eval.c +++ b/eval.c @@ -7406,6 +7406,14 @@ enum thread_status { /* +infty, for this purpose */ #define DELAY_INFTY 1E30 +#if !defined HAVE_PAUSE +# if defined _WIN32 && !defined __CYGWIN__ +# define pause() Sleep(INFINITE) +# else +# define pause() sleep(0x7fffffff) +# endif +#endif + /* typedef struct thread * rb_thread_t; */ struct thread { @@ -8642,14 +8650,6 @@ rb_thread_sleep(sec) rb_thread_wait_for(rb_time_timeval(INT2FIX(sec))); } -#if !defined HAVE_PAUSE -# if defined _WIN32 && !defined __CYGWIN__ -# define pause() Sleep(INFINITE) -# else -# define pause() sleep(0x7fffffff) -# endif -#endif - void rb_thread_sleep_forever() { diff --git a/file.c b/file.c index c3828b7175..9996423dd3 100644 --- a/file.c +++ b/file.c @@ -1755,7 +1755,6 @@ rb_file_s_basename(argc, argv) if (NIL_P(fext) || !(f = rmext(p, ext))) { f = chompdirsep(p) - p; } - basename = rb_str_new(p, f); } basename = rb_str_new(p, f); OBJ_INFECT(basename, fname); diff --git a/sample/test.rb b/sample/test.rb index 4b62fb32fb..d20f204da0 100644 --- a/sample/test.rb +++ b/sample/test.rb @@ -1655,9 +1655,16 @@ test_check "path" test_ok(File.basename("a") == "a") test_ok(File.basename("a/b") == "b") test_ok(File.basename("a/b/") == "b") +test_ok(File.basename("/") == "/") +test_ok(File.basename("//") == "/") +test_ok(File.basename("///") == "/") test_ok(File.basename("a/b////") == "b") test_ok(File.basename("a.rb", ".rb") == "a") +test_ok(File.basename("a.rb///", ".rb") == "a") +test_ok(File.basename("a.rb///", ".*") == "a") +test_ok(File.basename("a.rb///", ".c") == "a.rb") test_ok(File.dirname("a") == ".") +test_ok(File.dirname("/") == "/") test_ok(File.dirname("/a") == "/") test_ok(File.dirname("a/b") == "a") test_ok(File.dirname("a/b/c") == "a/b")