3 TEST_REGEX
= /TEST_F\([a-zA-Z0-9_]+,\s+([a-zA-Z0-9_]+)\)/
6 test_ex7_10_plain_characters
7 test_ex7_17_flow_mapping_separate_values
8 test_ex7_21_single_pair_implicit_entries
10 test_ex8_2_block_indentation_header
14 attr_accessor
:name, :ev, :src
25 .gsub(/([A-Z]+)([A-Z][a-z])/, '\1_\2')
26 .gsub(/([a-z\d])([A-Z])/, '\1_\2')
37 IO
.foreach(ARGV[0]) do |line
|
40 fail
"unexpected TEST_F" if line
=~ TEST_REGEX
45 if line
=~
/^EXPECT_CALL/
46 fail
'not end with ;' unless line
[-1] == ';'
47 v
= line
.gsub('(', ' ').gsub(')', ' ').split
51 next unless line
=~ TEST_REGEX
53 next unless name
=~
/^(Ex\d+_\d+)/
55 $stderr.puts
"found #{name}"
57 ctx
.name
= "test_#{name.snakecase}"
64 next if t
.ev
.size
== 0
65 if DISABLED_TESTS
.include? t
.name
66 puts
"#[allow(dead_code)]"
70 puts
"fn #{t.name}() {"
71 puts
" let mut v = str_to_test_events(#{t.src}).into_iter();"
73 puts
" assert_next!(v, TestEvent::#{e});"