0
0

More than 5 years have passed since last update.

class名を抜き出してプロダクトコードとテストコードが対になっていることを確認

Last updated at Posted at 2013-09-27
qiita.rb
product_list = []
testcode_list = []
# ファイルからclass xxを抜き出す
File.open("Program.cs").each do |paragraph|
  if  /class\s*\w*/ =~ paragraph then
    class_list =  $&.split(/\s/)
    product_list.push(class_list[1])
  end
end

File.open("ProgramTest.cs").each do |paragraph|
  if  /class\s*\w*/ =~ paragraph then
    class_list =  $&.split(/\s/)
    testcode_list = class_list[1]

    product_list.each{|t|
        if t == testcode_list.gsub(/Test/, "")
            print t + "\t"
            print testcode_list
            print "\n"
        end
    }   
  end
end
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0