diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-19 02:57:58 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-19 02:57:58 +0000 |
commit | be1c7e50e1e8809ea56f2c9d472eccd8ffd73a97 (patch) | |
tree | 9754ff1ca740f6346cf8483ec915d4054bc5da2d /web/server/h2o/libh2o/deps/mruby-errno/test/errno.rb | |
parent | Initial commit. (diff) | |
download | netdata-be1c7e50e1e8809ea56f2c9d472eccd8ffd73a97.tar.xz netdata-be1c7e50e1e8809ea56f2c9d472eccd8ffd73a97.zip |
Adding upstream version 1.44.3.upstream/1.44.3upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'web/server/h2o/libh2o/deps/mruby-errno/test/errno.rb')
-rw-r--r-- | web/server/h2o/libh2o/deps/mruby-errno/test/errno.rb | 60 |
1 files changed, 60 insertions, 0 deletions
diff --git a/web/server/h2o/libh2o/deps/mruby-errno/test/errno.rb b/web/server/h2o/libh2o/deps/mruby-errno/test/errno.rb new file mode 100644 index 00000000..79031156 --- /dev/null +++ b/web/server/h2o/libh2o/deps/mruby-errno/test/errno.rb @@ -0,0 +1,60 @@ +assert('Errno') do + Errno.class == Module +end + +assert('SystemCallError') do + SystemCallError.class == Class +end + +assert('SystemCallError superclass') do + SystemCallError.superclass == StandardError +end + +assert('SystemCallError#initialize') do + SystemCallError.new("a").message == "unknown error - a" and + SystemCallError.new("a", 12345).message == "Unknown error: 12345 - a" and + SystemCallError.new(12345).message == "Unknown error: 12345" +end + +assert('SystemCallError#errno') do + assert_equal 1, SystemCallError.new("a", 1).errno + assert_equal 1, SystemCallError.new(1).errno + assert_equal 12345, SystemCallError.new("a", 12345).errno + assert_equal 23456, SystemCallError.new(23456).errno +end + +assert('SystemCallError#inspect') do + SystemCallError.new("a").inspect == "SystemCallError: unknown error - a" + end + +assert('Errno::NOERROR') do + Errno::NOERROR.class == Class +end + +# Is there any platform does not have EPERM? +assert('Errno::EPERM') do + Errno::EPERM.class == Class +end + +assert('Errno::EPERM superclass') do + Errno::EPERM.superclass == SystemCallError +end + +assert('Errno::EPERM::Errno') do + Errno::EPERM::Errno.is_a? Fixnum +end + +assert('Errno::EPERM#message') do + msg = Errno::EPERM.new.message + Errno::EPERM.new("a").message == "#{msg} - a" +end + +assert('Errno::EPERM#inspect 1') do + msg = Errno::EPERM.new.message + Errno::EPERM.new.inspect == "Errno::EPERM: #{msg}" +end + +assert('Errno::EPERM#inspect 2') do + msg = Errno::EPERM.new.message + Errno::EPERM.new("a").inspect == "Errno::EPERM: #{msg} - a" +end |