From 7d19b61b8801a9e5666f62a1018713854b92d936 Mon Sep 17 00:00:00 2001 From: sue445 Date: Tue, 1 Dec 2026 21:22:05 +0900 Subject: [PATCH] Accept both C boolean spellings in parser specs The Ubuntu 26.04 Ruby 4.0 job reported "113 examples, 1 failure" because rb_scan_args_set's flags were parsed as bool while the spec expected _Bool. C23 preserves bool as a keyword, while preprocessors in older C modes can expand it to _Bool. Co-authored-by: Codex --- spec/ruby_header_parser/parser_spec.rb | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/spec/ruby_header_parser/parser_spec.rb b/spec/ruby_header_parser/parser_spec.rb index bab40ce..fd3dd63 100644 --- a/spec/ruby_header_parser/parser_spec.rb +++ b/spec/ruby_header_parser/parser_spec.rb @@ -276,6 +276,9 @@ context "rb_scan_args_set" do subject { definitions.find { |d| d.name == "rb_scan_args_set" } } + # Pre-C23 preprocessors may expand bool from to _Bool. + let(:bool_type) { match(/\A(?:bool|_Bool)\z/) } + let(:args) do [ argument(type: "int", name: "kw_flag"), @@ -284,9 +287,9 @@ argument(type: "int", name: "n_lead"), argument(type: "int", name: "n_opt"), argument(type: "int", name: "n_trail"), - argument(type: "_Bool", name: "f_var"), - argument(type: "_Bool", name: "f_hash"), - argument(type: "_Bool", name: "f_block"), + have_attributes(type: bool_type, name: "f_var", pointer: nil, length: 0), + have_attributes(type: bool_type, name: "f_hash", pointer: nil, length: 0), + have_attributes(type: bool_type, name: "f_block", pointer: nil, length: 0), argument(type: "VALUE", name: "vars", pointer: :ref_array), argument(type: "char", name: "fmt", pointer: :ref), argument(type: "int", name: "varc"), @@ -296,7 +299,7 @@ its(:name) { should eq "rb_scan_args_set" } its(:definition) { should eq "rb_scan_args_set(int kw_flag, int argc, const VALUE *argv," } # TODO: Fix this after its(:typeref) { should eq typeref(type: "int") } - its(:args) { should eq args } + its(:args) { should match args } end context "RSTRING_END" do