From 9895733a05dd399d40b690a8e674f66d50aed9ad Mon Sep 17 00:00:00 2001 From: Josh Holtrop Date: Thu, 29 Jun 2023 19:16:36 -0400 Subject: [PATCH] Switch unit tests from gdc to ldc2 --- assets/parser.d.erb | 14 +++++++------- spec/propane_spec.rb | 3 ++- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/assets/parser.d.erb b/assets/parser.d.erb index 57f4148..d5f5b03 100644 --- a/assets/parser.d.erb +++ b/assets/parser.d.erb @@ -56,7 +56,7 @@ class <%= @classname %> alias CodePoint = uint; - static immutable string token_names[] = [ + static immutable string[] token_names = [ <% @grammar.tokens.each_with_index do |token, index| %> "<%= token.name %>", <% end %> @@ -237,13 +237,13 @@ class <%= @classname %> } <% transition_table, state_table, mode_table = @lexer.build_tables %> - private static immutable Transition transitions[] = [ + private static immutable Transition[] transitions = [ <% transition_table.each do |transition_table_entry| %> Transition(<%= transition_table_entry[:first] %>u, <%= transition_table_entry[:last] %>u, <%= transition_table_entry[:destination] %>u), <% end %> ]; - private static immutable State states[] = [ + private static immutable State[] states = [ <% state_table.each do |state_table_entry| %> State(<%= state_table_entry[:transition_table_index] %>u, <%= state_table_entry[:n_transitions] %>u, @@ -261,7 +261,7 @@ class <%= @classname %> <% end %> ]; - private static immutable Mode modes[] = [ + private static immutable Mode[] modes = [ <% mode_table.each do |mode_table_entry| %> Mode(<%= mode_table_entry[:state_table_offset] %>), <% end %> @@ -642,19 +642,19 @@ class <%= @classname %> } <% state_table, shift_table, reduce_table = @parser.build_tables %> - private static immutable Shift shifts[] = [ + private static immutable Shift[] shifts = [ <% shift_table.each do |shift| %> Shift(<%= shift[:token_id] %>u, <%= shift[:state_id] %>u), <% end %> ]; - private static immutable Reduce reduces[] = [ + private static immutable Reduce[] reduces = [ <% reduce_table.each do |reduce| %> Reduce(<%= reduce[:token_id] %>u, <%= reduce[:rule_id] %>u, <%= reduce[:rule_set_id] %>u, <%= reduce[:n_states] %>u), <% end %> ]; - private static immutable State states[] = [ + private static immutable State[] states = [ <% state_table.each do |state| %> State(<%= state[:shift_index] %>u, <%= state[:n_shifts] %>u, <%= state[:reduce_index] %>u, <%= state[:n_reduces] %>u), <% end %> diff --git a/spec/propane_spec.rb b/spec/propane_spec.rb index 894b162..d83f1c1 100644 --- a/spec/propane_spec.rb +++ b/spec/propane_spec.rb @@ -20,7 +20,7 @@ describe Propane do end def compile(*test_files) - result = system(*%w[gdc -funittest -o spec/run/testparser spec/run/testparser.d -Ispec], *test_files) + result = system(*%w[ldc2 --unittest -of spec/run/testparser spec/run/testparser.d -Ispec], *test_files) expect(result).to be_truthy end @@ -28,6 +28,7 @@ describe Propane do stdout, stderr, status = Open3.capture3("spec/run/testparser") File.binwrite("spec/run/.stderr", stderr) File.binwrite("spec/run/.stdout", stdout) + stderr.sub!(/^.*modules passed unittests\n/, "") Results.new(stdout, stderr, status) end