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/test/t/unicode.rb | |
parent | Initial commit. (diff) | |
download | netdata-upstream.tar.xz netdata-upstream.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/test/t/unicode.rb')
-rw-r--r-- | web/server/h2o/libh2o/deps/mruby/test/t/unicode.rb | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/web/server/h2o/libh2o/deps/mruby/test/t/unicode.rb b/web/server/h2o/libh2o/deps/mruby/test/t/unicode.rb new file mode 100644 index 00000000..8622ae08 --- /dev/null +++ b/web/server/h2o/libh2o/deps/mruby/test/t/unicode.rb @@ -0,0 +1,39 @@ +# Test of the \u notation + +assert('bare \u notation test') do + # Mininum and maximum one byte characters + assert_equal("\x00", "\u0000") + assert_equal("\x7F", "\u007F") + + # Mininum and maximum two byte characters + assert_equal("\xC2\x80", "\u0080") + assert_equal("\xDF\xBF", "\u07FF") + + # Mininum and maximum three byte characters + assert_equal("\xE0\xA0\x80", "\u0800") + assert_equal("\xEF\xBF\xBF", "\uFFFF") + + # Four byte characters require the \U notation +end + +assert('braced \u notation test') do + # Mininum and maximum one byte characters + assert_equal("\x00", "\u{0000}") + assert_equal("\x7F", "\u{007F}") + + # Mininum and maximum two byte characters + assert_equal("\xC2\x80", "\u{0080}") + assert_equal("\xDF\xBF", "\u{07FF}") + + # Mininum and maximum three byte characters + assert_equal("\xE0\xA0\x80", "\u{0800}") + assert_equal("\xEF\xBF\xBF", "\u{FFFF}") + + # Mininum and maximum four byte characters + assert_equal("\xF0\x90\x80\x80", "\u{10000}") + assert_equal("\xF4\x8F\xBF\xBF", "\u{10FFFF}") +end + +assert('braced multiple \u notation test') do + assert_equal("ABC", "\u{41 42 43}") +end |