Last active
December 28, 2015 23:49
-
-
Save jsuo/7581371 to your computer and use it in GitHub Desktop.
Function sayHello のテストコード
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#coding: windows-31j | |
require './exlap' | |
describe "Function sayHello のテスト" do | |
before(:all) do | |
test_module = <<EOF | |
Function testSayHello(ByVal arg As String) As String | |
testSayHello = Module1.sayHello(arg) | |
End Function | |
EOF | |
xlApp = Exlap.new | |
book_name = "受注検索.xlsm" | |
#受注検索.xlsmを開く | |
@wb = xlApp.book_open book_name | |
#TestModuleという名前で標準モジュールを追加する | |
@wb.macro_add(test_module, 1, "TestModule") | |
@test_method = "TestModule.testSayHello" | |
end | |
after(:all) do | |
#保存せずに閉じる | |
@wb.close | |
end | |
describe "引数 Tom :" do | |
it "結果は Hello! Tom となること" do | |
result = @wb.run(@test_method, "Tom") | |
result.should == "Hello! Tom" | |
end | |
end | |
describe "引数 明子 :" do | |
it "結果は Hello! 明子 となること" do | |
result = @wb.run(@test_method, "明子") | |
result.should == "Hello! 明子" | |
end | |
end | |
describe "引数 [スペース] :" do | |
it "結果は Hello! 名無し となること" do | |
result = @wb.run(@test_method, " ") | |
result.should == "Hello! 名無し" | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment