File tree Expand file tree Collapse file tree 2 files changed +17
-1
lines changed Expand file tree Collapse file tree 2 files changed +17
-1
lines changed Original file line number Diff line number Diff line change 1
1
# Changelog
2
2
3
+ * Avoid mutating the options hash passed to a render object.
4
+
5
+ Refs #663 .
6
+
7
+ * Max Schwenk*
8
+
3
9
* Fix a segfault rendering quotes using ` StripDown ` and the ` :quote `
4
10
option.
5
11
Original file line number Diff line number Diff line change @@ -23,7 +23,7 @@ def test_simple_overload
23
23
end
24
24
25
25
def test_renderer_options
26
- parser = Redcarpet ::Markdown . new ( SimpleRender . new ( { with_toc_data : true } . freeze ) , { } )
26
+ parser = Redcarpet ::Markdown . new ( SimpleRender . new ( with_toc_data : true ) )
27
27
output = parser . render ( "# A title" )
28
28
29
29
assert_match "My little poney" , output
@@ -36,6 +36,16 @@ def test_markdown_options
36
36
assert_match "no_intra_emphasis" , output
37
37
end
38
38
39
+ def test_original_options_hash_is_not_mutated
40
+ options = { with_toc_data : true }
41
+ render = SimpleRender . new ( options )
42
+ parser = Redcarpet ::Markdown . new ( render , tables : true )
43
+
44
+ computed_options = render . instance_variable_get ( :"@options" )
45
+
46
+ refute_equal computed_options . object_id , options . object_id
47
+ end
48
+
39
49
class NilPreprocessRenderer < Redcarpet ::Render ::HTML
40
50
def preprocess ( fulldoc )
41
51
nil
You can’t perform that action at this time.
0 commit comments