forked from cpputest/cpputest
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcpp_u_test_to_unity.rb
More file actions
executable file
·24 lines (21 loc) · 924 Bytes
/
Copy pathcpp_u_test_to_unity.rb
File metadata and controls
executable file
·24 lines (21 loc) · 924 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#!/usr/bin/env ruby
require File.join(File.dirname(__FILE__), 'cpp_u_test_to_unity_utils.rb')
include CppUTestToUnityUtils
in_file = ARGV[0]
unity_filename = convert_test_filename_to_unity_filename(in_file)
unity_runner_filename = convert_test_filename_to_unity_testrunner_filename(in_file)
puts "Converting :" + in_file + "\n"
puts " To :" + unity_filename + "\n"
test_lines = File.open(in_file).readlines
out_unity_file = File.open(unity_filename, 'w')
out_unity_runner_file = File.open(unity_runner_filename, 'w')
test_groups = get_test_groups(test_lines)
adjust_tabs(test_lines)
remove_extern_c(test_lines)
demote_group(/TEST_GROUP/, test_lines)
convert_macros(test_lines, test_groups)
group_runners = generate_group_runners(test_groups, test_lines)
write_lines_to_file(out_unity_file, test_lines)
write_lines_to_file(out_unity_runner_file, group_runners)
out_unity_file.close()
out_unity_runner_file.close()