diff --git a/Tests/Tools/ToolsTest.j b/Tests/Tools/ToolsTest.j index 521dc7afc..5d59fb666 100644 --- a/Tests/Tools/ToolsTest.j +++ b/Tests/Tools/ToolsTest.j @@ -35,7 +35,7 @@ function cleanup() { - (void)testTools { var status, - rootDirectory = ""//FILE.cwd(); + rootDirectory = process.cwd(); [self assertNoThrow: function() { childProcess.execSync(["capp", "gen", "ToolsTestApp"].map(utilsFile.enquote).join(" ") + " > /dev/null", {stdio: 'inherit'}); @@ -56,40 +56,37 @@ function cleanup() { }]; status = [self assertThrows: function() { - debugger; return childProcess.execSync(["objj", "--xml", "objjErrorTestFile.j"].map(utilsFile.enquote).join(" "), {stdio: 'pipe'}); }]; [self assert:"\nline1sourcePath" + rootDirectory + "/objjErrorTestFile.jmessage\ \n@implementation AppController : CPObject{}@end\ \n ^\ -\nERROR line 1 in file:" + rootDirectory + "/objjErrorTestFile.j:1: Can't find superclass CPObject\n" equals:status message:"objj failed"]; - - process.exit(0); +\nERROR line 1 in file:" + rootDirectory + "/objjErrorTestFile.j:1: Can't find superclass CPObject\n" equals:status.stdout.toString() message:"objj failed"]; status = [self assertNoThrow: function() { - childProcess.execSync(["objj", "-x", "objjWarningTestFile.j"].map(utilsFile.enquote).join(" "), {stdio: 'inherit'}); + return childProcess.execSync(["objj", "-x", "objjWarningTestFile.j"].map(utilsFile.enquote).join(" "), {stdio: 'pipe'}); }]; [self assert:"\nline1sourcePath" + rootDirectory + "/objjWarningTestFile.jmessage\n@import <Foundation/Foundation.j>@implementation AppController : CPObject{CPWindow theWindow;}@end\ \n ^\ -\nWARNING line 1 in file:" + rootDirectory + "/objjWarningTestFile.j:1: Unknown type 'CPWindow' for ivar 'theWindow'\n" equals:status message:"objj failed"]; +\nWARNING line 1 in file:" + rootDirectory + "/objjWarningTestFile.j:1: Unknown type 'CPWindow' for ivar 'theWindow'\n" equals:status.toString() message:"objj failed"]; [self assertNoThrow: function() { - childProcess.execSync(["objj", "-m", "ToolsTestApp/AppController.j", "ToolsTestApp/AppController.j"], {stdio: 'inherit'}); + childProcess.execSync(["objj", "-m", "ToolsTestApp/AppController.j", "ToolsTestApp/AppController.j"].map(utilsFile.enquote).join(" "), {stdio: 'ignore'}); }]; [self assertNoThrow: function() { - childProcess.execSync(["objj", "-I", "ToolsTestApp/Frameworks", "ToolsTestApp/AppController.j"], {stdio: 'inherit'}); + childProcess.execSync(["objj", "-IToolsTestApp/Frameworks", "ToolsTestApp/AppController.j"].map(utilsFile.enquote).join(" "), {stdio: 'ignore'}); }]; [self assertNoThrow: function() { - childProcess.execSync(["objj2objcskeleton", "objj2objcskeletonTestFile.j", "."], {stdio: 'inherit'}); + childProcess.execSync(["objj2objcskeleton", "objj2objcskeletonTestFile.j", "."].map(utilsFile.enquote).join(" "), {stdio: 'ignore'}); }]; - var contentHeader = fs.readFileSync("objj2objcskeletonTestFile.h"), + var contentHeader = fs.readFileSync("objj2objcskeletonTestFile.h").toString(), expectedHeaderResult = "#import \n#import \"xcc_general_include.h\"\n\n@interface AppController : NSObject\n\n@property (assign) IBOutlet NSSplitView* splitViewA;\n@property (assign) IBOutlet NSSplitView* splitViewB;\n@property (assign) IBOutlet NSSplitView* splitViewC;\n\n@end\n"; [self assert:contentHeader equals:expectedHeaderResult message:@"Header generated by objj2objcskeleton is wrong"]; - var contentMFile = fs.readFileSync("objj2objcskeletonTestFile.m"), + var contentMFile = fs.readFileSync("objj2objcskeletonTestFile.m").toString(), expectedMResult = "#import \"objj2objcskeletonTestFile.h\"\n\n@implementation AppController\n@end\n"; [self assert:contentMFile equals:expectedMResult message:@"File generated by objj2objcskeleton is wrong"];