From ec75e47ae2a8418998877977c3ae41eed563430b Mon Sep 17 00:00:00 2001 From: Jay Rainey Date: Fri, 13 Dec 2013 12:08:41 +0000 Subject: [PATCH] Updated unit test to verify ScriptText is correct. Refs #8599. --- .../Framework/Algorithms/test/GeneratePythonScriptTest.h | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/Code/Mantid/Framework/Algorithms/test/GeneratePythonScriptTest.h b/Code/Mantid/Framework/Algorithms/test/GeneratePythonScriptTest.h index a7e49bfdbcf7..e93ae3f49679 100644 --- a/Code/Mantid/Framework/Algorithms/test/GeneratePythonScriptTest.h +++ b/Code/Mantid/Framework/Algorithms/test/GeneratePythonScriptTest.h @@ -52,21 +52,26 @@ class GeneratePythonScriptTest : public CxxTest::TestSuite TS_ASSERT( alg.isInitialized() ); TS_ASSERT_THROWS_NOTHING( alg.setPropertyValue("InputWorkspace", workspaceName) ); TS_ASSERT_THROWS_NOTHING( alg.setPropertyValue("Filename", "GeneratePythonScriptTest.py") ); + TS_ASSERT_THROWS_NOTHING( alg.setPropertyValue("ScriptText", "") ); TS_ASSERT_THROWS_NOTHING( alg.execute(); ); TS_ASSERT( alg.isExecuted() ); - // Compare the contents of the file to the expected result line-by-line. std::string filename = alg.getProperty("Filename"); std::ifstream file(filename.c_str(), std::ifstream::in); std::string scriptLine; int lineCount(0); + while(std::getline(file, scriptLine)) { TS_ASSERT_EQUALS(scriptLine,result[lineCount]); lineCount++; } + // Verify that if we set the content of ScriptText that it is set correctly. + alg.setPropertyValue("ScriptText", result[4]); + TS_ASSERT_EQUALS(alg.getPropertyValue("ScriptText"), "CropWorkspace(InputWorkspace='testGeneratePython',OutputWorkspace='testGeneratePython',XMin='2',XMax='5')"); + file.close(); if (Poco::File(filename).exists()) Poco::File(filename).remove(); }