Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
mruby
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Libraries
mruby
Commits
32bfa1f1
Commit
32bfa1f1
authored
May 28, 2014
by
take_cheeze
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add invalid key type check in `Struct#[]=`.
parent
7bc4d08f
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
2 additions
and
1 deletion
+2
-1
mrbgems/mruby-struct/src/struct.c
mrbgems/mruby-struct/src/struct.c
+1
-1
mrbgems/mruby-struct/test/struct.rb
mrbgems/mruby-struct/test/struct.rb
+1
-0
No files found.
mrbgems/mruby-struct/src/struct.c
View file @
32bfa1f1
...
...
@@ -672,7 +672,7 @@ mrb_struct_aset(mrb_state *mrb, mrb_value s)
return
mrb_struct_aset_sym
(
mrb
,
s
,
mrb_symbol
(
idx
),
val
);
}
i
=
mrb_
fixnum
(
idx
);
i
=
mrb_
int
(
mrb
,
idx
);
if
(
i
<
0
)
i
=
RSTRUCT_LEN
(
s
)
+
i
;
if
(
i
<
0
)
{
mrb_raisef
(
mrb
,
E_INDEX_ERROR
,
...
...
mrbgems/mruby-struct/test/struct.rb
View file @
32bfa1f1
...
...
@@ -41,6 +41,7 @@ assert('Struct#[]=', '15.2.18.4.3') do
cc
[
:m1
]
==
3
cc
[
"m2"
]
=
3
assert_equal
3
,
cc
[
"m2"
]
assert_raise
(
TypeError
)
{
cc
[[]]
=
3
}
end
assert
(
'Struct#each'
,
'15.2.18.4.4'
)
do
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment