Switch unit tests from gdc to ldc2
This commit is contained in:
parent
11348ca351
commit
9895733a05
@ -56,7 +56,7 @@ class <%= @classname %>
|
|||||||
|
|
||||||
alias CodePoint = uint;
|
alias CodePoint = uint;
|
||||||
|
|
||||||
static immutable string token_names[] = [
|
static immutable string[] token_names = [
|
||||||
<% @grammar.tokens.each_with_index do |token, index| %>
|
<% @grammar.tokens.each_with_index do |token, index| %>
|
||||||
"<%= token.name %>",
|
"<%= token.name %>",
|
||||||
<% end %>
|
<% end %>
|
||||||
@ -237,13 +237,13 @@ class <%= @classname %>
|
|||||||
}
|
}
|
||||||
|
|
||||||
<% transition_table, state_table, mode_table = @lexer.build_tables %>
|
<% 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_table.each do |transition_table_entry| %>
|
||||||
Transition(<%= transition_table_entry[:first] %>u, <%= transition_table_entry[:last] %>u, <%= transition_table_entry[:destination] %>u),
|
Transition(<%= transition_table_entry[:first] %>u, <%= transition_table_entry[:last] %>u, <%= transition_table_entry[:destination] %>u),
|
||||||
<% end %>
|
<% end %>
|
||||||
];
|
];
|
||||||
|
|
||||||
private static immutable State states[] = [
|
private static immutable State[] states = [
|
||||||
<% state_table.each do |state_table_entry| %>
|
<% state_table.each do |state_table_entry| %>
|
||||||
State(<%= state_table_entry[:transition_table_index] %>u,
|
State(<%= state_table_entry[:transition_table_index] %>u,
|
||||||
<%= state_table_entry[:n_transitions] %>u,
|
<%= state_table_entry[:n_transitions] %>u,
|
||||||
@ -261,7 +261,7 @@ class <%= @classname %>
|
|||||||
<% end %>
|
<% end %>
|
||||||
];
|
];
|
||||||
|
|
||||||
private static immutable Mode modes[] = [
|
private static immutable Mode[] modes = [
|
||||||
<% mode_table.each do |mode_table_entry| %>
|
<% mode_table.each do |mode_table_entry| %>
|
||||||
Mode(<%= mode_table_entry[:state_table_offset] %>),
|
Mode(<%= mode_table_entry[:state_table_offset] %>),
|
||||||
<% end %>
|
<% end %>
|
||||||
@ -642,19 +642,19 @@ class <%= @classname %>
|
|||||||
}
|
}
|
||||||
|
|
||||||
<% state_table, shift_table, reduce_table = @parser.build_tables %>
|
<% 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_table.each do |shift| %>
|
||||||
Shift(<%= shift[:token_id] %>u, <%= shift[:state_id] %>u),
|
Shift(<%= shift[:token_id] %>u, <%= shift[:state_id] %>u),
|
||||||
<% end %>
|
<% end %>
|
||||||
];
|
];
|
||||||
|
|
||||||
private static immutable Reduce reduces[] = [
|
private static immutable Reduce[] reduces = [
|
||||||
<% reduce_table.each do |reduce| %>
|
<% reduce_table.each do |reduce| %>
|
||||||
Reduce(<%= reduce[:token_id] %>u, <%= reduce[:rule_id] %>u, <%= reduce[:rule_set_id] %>u, <%= reduce[:n_states] %>u),
|
Reduce(<%= reduce[:token_id] %>u, <%= reduce[:rule_id] %>u, <%= reduce[:rule_set_id] %>u, <%= reduce[:n_states] %>u),
|
||||||
<% end %>
|
<% end %>
|
||||||
];
|
];
|
||||||
|
|
||||||
private static immutable State states[] = [
|
private static immutable State[] states = [
|
||||||
<% state_table.each do |state| %>
|
<% state_table.each do |state| %>
|
||||||
State(<%= state[:shift_index] %>u, <%= state[:n_shifts] %>u, <%= state[:reduce_index] %>u, <%= state[:n_reduces] %>u),
|
State(<%= state[:shift_index] %>u, <%= state[:n_shifts] %>u, <%= state[:reduce_index] %>u, <%= state[:n_reduces] %>u),
|
||||||
<% end %>
|
<% end %>
|
||||||
|
@ -20,7 +20,7 @@ describe Propane do
|
|||||||
end
|
end
|
||||||
|
|
||||||
def compile(*test_files)
|
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
|
expect(result).to be_truthy
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -28,6 +28,7 @@ describe Propane do
|
|||||||
stdout, stderr, status = Open3.capture3("spec/run/testparser")
|
stdout, stderr, status = Open3.capture3("spec/run/testparser")
|
||||||
File.binwrite("spec/run/.stderr", stderr)
|
File.binwrite("spec/run/.stderr", stderr)
|
||||||
File.binwrite("spec/run/.stdout", stdout)
|
File.binwrite("spec/run/.stdout", stdout)
|
||||||
|
stderr.sub!(/^.*modules passed unittests\n/, "")
|
||||||
Results.new(stdout, stderr, status)
|
Results.new(stdout, stderr, status)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user