File: update_summary_tests_list.rb

package info (click to toggle)
libpg-query 17-6.2.0-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 33,416 kB
  • sloc: ansic: 175,684; sql: 79,564; ruby: 1,605; makefile: 276; cpp: 221
file content (14 lines) | stat: -rwxr-xr-x 492 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
#!/usr/bin/env ruby

summary_tests = File.join(__dir__, "..", "test", "summary_tests.c")
summary_tests_list = File.join(__dir__, "..", "test", "summary_tests_list.c")

is_fn_decl = -> (l) { l.start_with?('void ') }
get_fn_name = -> (l) { l.split(' ')[1].split('(')[0] }
to_ref = -> (n) { "&#{n}," }

fns = File.readlines(summary_tests).filter(&is_fn_decl).map(&get_fn_name).map(&to_ref)

lines = ["// Generated by #{__FILE__}", "", *fns, ""]

File.write(summary_tests_list, lines.join("\n"))