Skip to content

Commit ca4bdb1

Browse files
committed
Update preprocessor test.
1 parent 21abe99 commit ca4bdb1

File tree

1 file changed

+6
-35
lines changed

1 file changed

+6
-35
lines changed

test/truffle/cexts/test_preprocess.rb

Lines changed: 6 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -14,46 +14,17 @@ def test_patch(file, directory, input, expected)
1414
end
1515

1616
original = <<-EOF
17-
static void warning_func(void * ctx, const char *msg, ...)
17+
static int dealloc_node_i(xmlNodePtr key, xmlNodePtr node, xmlDocPtr doc)
1818
{
19-
VALUE self = NOKOGIRI_SAX_SELF(ctx);
20-
VALUE doc = rb_iv_get(self, "@document");
21-
char * message;
22-
VALUE ruby_message;
23-
24-
va_list args;
25-
va_start(args, msg);
26-
vasprintf(&message, msg, args);
27-
va_end(args);
28-
29-
ruby_message = NOKOGIRI_STR_NEW2(message);
30-
vasprintf_free(message);
31-
rb_funcall(doc, id_warning, 1, ruby_message);
3219
}
3320
EOF
3421

3522
modified = <<-EOF
36-
static void warning_func(void * ctx, const char *msg, ...)
23+
static int dealloc_node_i(st_data_t a, st_data_t b, st_data_t c, int errorState)
3724
{
38-
VALUE self = NOKOGIRI_SAX_SELF(ctx);
39-
VALUE doc = rb_iv_get(self, "@document");
40-
char * message;
41-
VALUE ruby_message;
42-
43-
#ifdef NOKOGIRI_PACKAGED_LIBRARIES
44-
va_list args;
45-
va_start(args, msg);
46-
vasprintf(&message, msg, args);
47-
va_end(args);
48-
49-
ruby_message = NOKOGIRI_STR_NEW2(message);
50-
vasprintf_free(message);
51-
rb_funcall(doc, id_warning, 1, ruby_message);
52-
#else
53-
rb_funcall(doc, id_warning, 1, NOKOGIRI_STR_NEW2("Warning."));
54-
#endif
55-
56-
}
25+
xmlNodePtr key = (xmlNodePtr)a;
26+
xmlNodePtr node = (xmlNodePtr)b;
27+
xmlDocPtr doc = (xmlDocPtr)c;}
5728
EOF
5829

5930
json_original = <<-EOF
@@ -68,7 +39,7 @@ def test_patch(file, directory, input, expected)
6839
# endif
6940
EOF
7041

71-
test_patch 'xml_sax_parser.c', 'ext/nokogiri', original, modified
42+
test_patch 'xml_document.c', 'ext/nokogiri', original, modified
7243
# Should not patch other files or other gems
7344
test_patch 'other_file.c', 'ext/nokogiri', original, original
7445
test_patch 'xml_sax_parser.c', 'ext/other_gem', original, original

0 commit comments

Comments
 (0)