I am creating a small test framework that uses a JavaScript module template to test user interface automation in iOS. However, it looks like I am getting odd results based on #import and module extensions.
I have a basic test module called Tester-Module.js :
(function() { var Tester = this.Tester = {}; Tester.setUp = function() { UIALogger.logMessage('Regular SetUp()'); } }).call(this);
If I import this module into my test case, it works fine. Here's the test file tester.js ( tester.js is the file that I import into Tools):
#import "./Tester-Module.js"
However, if I try to extend the Tester-Module.js in another module file, I cannot reference the Tester object. Tester-Extension.js extends the tester module defined in Tester-Module.js :
#import "./Tester-Module.js" // Outputs: // Exception raised while running script: // ReferenceError: Can't find variable: Tester\n Tester.setUp = function() { UIALogger.logMessage('Overwritten SetUp()'); }
And the updated tester.js test file file:
#import "./Tester-Extension.js"
My reliable related questions:
Why can't I reference the Tester object inside Tester-Extension.js , but maybe in tester.js ?
What does macroC # import do?
baalexander
source share