Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions pack.c
Original file line number Diff line number Diff line change
Expand Up @@ -167,8 +167,8 @@ unknown_directive(const char *mode, char type, VALUE fmt)
snprintf(unknown, sizeof(unknown), "\\x%.2x", type & 0xff);
}
fmt = rb_str_quote_unprintable(fmt);
rb_warning("unknown %s directive '%s' in '%"PRIsVALUE"'",
mode, unknown, fmt);
rb_warn("unknown %s directive '%s' in '%"PRIsVALUE"'",
mode, unknown, fmt);
}

static float
Expand Down
12 changes: 2 additions & 10 deletions test/ruby/test_pack.rb
Original file line number Diff line number Diff line change
Expand Up @@ -777,21 +777,13 @@ def test_short_with_block
end

def test_pack_garbage
assert_warn("") do
assert_equal "\000", [0].pack("*U")
end

assert_warning(%r%unknown pack directive '\*' in '\*U'$%) do
assert_warn(%r%unknown pack directive '\*' in '\*U'$%) do
assert_equal "\000", [0].pack("*U")
end
end

def test_unpack_garbage
assert_warn("") do
assert_equal [0], "\000".unpack("*U")
end

assert_warning(%r%unknown unpack directive '\*' in '\*U'$%) do
assert_warn(%r%unknown unpack directive '\*' in '\*U'$%) do
assert_equal [0], "\000".unpack("*U")
end
end
Expand Down