conversations
list
source
string
stack
string
[ { "from": "system", "value": "Move Pass() to the end of the block\n\nThis is more in par with the common order of commands.\n" }, { "from": "human", "value": "#pragma rtGlobals=3\n#pragma TextEncoding=\"UTF-8\"\n#pragma ModuleName=Example8\n\n#include \"unit-testing\"\n\n// Command: RunTest(\"example8-uncaught-runtime-errors.ipf\")\n// Shows when User code generates an uncaught Runtime Error.\n// The test environment catches this condition and gives\n// a detailed error message in the history\n// The Runtime Error is of course treated as FAIL\n\nFunction TestWaveOp()\n\t\tWAVE/Z/SDFR=$\"I dont exist\" wv;\nEnd\n\n// There might be situations where the user wants to catch a runtime error\n// (RTE) himself. This function shows how to catch the RTE before the test\n// environment handles it. The test environment is controlled manually by\n// PASS() and FAIL() PASS() increases the assertion counter and FAIL() treats\n// this assertion as fail when a RTE was caught.\n//\n// Note: As this code can hide critical errors from the test environment it may\n// render test runs unreliable.\nFunction TestWaveOpSelfCatch()\n\ttry\n\t\tPASS()\n\t\tWAVE/Z/SDFR=$\"I dont exist\" wv;AbortOnRTE\n\tcatch\n\t\t// Do not forget to clear the RTE\n\t\tvariable err = getRTError(1)\n\t\tFAIL()\n\tendtry\nEnd\n" }, { "from": "gpt", "value": "#pragma rtGlobals=3\n#pragma TextEncoding=\"UTF-8\"\n#pragma ModuleName=Example8\n\n#include \"unit-testing\"\n\n// Command: RunTest(\"example8-uncaught-runtime-errors.ipf\")\n// Shows when User code generates an uncaught Runtime Error.\n// The test environment catches this condition and gives\n// a detailed error message in the history\n// The Runtime Error is of course treated as FAIL\n\nFunction TestWaveOp()\n\t\tWAVE/Z/SDFR=$\"I dont exist\" wv;\nEnd\n\n// There might be situations where the user wants to catch a runtime error\n// (RTE) himself. This function shows how to catch the RTE before the test\n// environment handles it. The test environment is controlled manually by\n// PASS() and FAIL() PASS() increases the assertion counter and FAIL() treats\n// this assertion as fail when a RTE was caught.\n//\n// Note: As this code can hide critical errors from the test environment it may\n// render test runs unreliable.\nFunction TestWaveOpSelfCatch()\n\ttry\n\t\tWAVE/Z/SDFR=$\"I dont exist\" wv;AbortOnRTE\n\t\tPASS()\n\tcatch\n\t\t// Do not forget to clear the RTE\n\t\tvariable err = getRTError(1)\n\t\tFAIL()\n\tendtry\nEnd\n" } ]
igor-pro
chosen
README.md exists but content is empty.
Downloads last month
37