Commit ac64c139c84470a306c09a3be2e25f3bbdc4792e

Thomas de Grivel 2023-04-12T17:49:51

test_case_end.rb

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
diff --git a/test/test_case_end.rb b/test/test_case_end.rb
new file mode 100644
index 0000000..e61f042
--- /dev/null
+++ b/test/test_case_end.rb
@@ -0,0 +1,15 @@
+Dir["*.c"].each do |file|
+  file_tmp = file + ".tmp"
+  File.open(file_tmp, "w") do |out|
+    test_case_name = nil
+    File.foreach(file) do |line|
+      line.match(/^TEST_CASE\((.*)\)$/) do |m|
+        test_case_name = m[1]
+      end
+      out.write line
+      out.puts "TEST_CASE_END(#{test_case_name})" if line == "}\n"
+    end
+  end
+  FileUtils.cp(file, file + "~")
+  FileUtils.mv(file_tmp, file)
+end