Fixed: Converting the test cases in ToolTest.j to Node

This commit is contained in:
Martin Carlberg
2021-09-15 17:33:21 +02:00
parent b7c04d7d16
commit 2a0a6449e5
+9 -12
View File
@@ -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:"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!DOCTYPE plist PUBLIC \"-//Apple//DTD PLIST 1.0//EN\" \"http://www.apple.com/DTDs/PropertyList-1.0.dtd\"><plist version = \"1.0\"><array><dict><key>line</key><integer>1</integer><key>sourcePath</key><string>" + rootDirectory + "/objjErrorTestFile.j</string><key>message</key><string>\
\n@implementation AppController : CPObject{}@end\
\n ^\
\nERROR line 1 in file:" + rootDirectory + "/objjErrorTestFile.j:1: Can&apos;t find superclass CPObject</string></dict></array></plist>\n" equals:status message:"objj failed"];
process.exit(0);
\nERROR line 1 in file:" + rootDirectory + "/objjErrorTestFile.j:1: Can&apos;t find superclass CPObject</string></dict></array></plist>\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:"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!DOCTYPE plist PUBLIC \"-//Apple//DTD PLIST 1.0//EN\" \"http://www.apple.com/DTDs/PropertyList-1.0.dtd\"><plist version = \"1.0\"><array><dict><key>line</key><integer>1</integer><key>sourcePath</key><string>" + rootDirectory + "/objjWarningTestFile.j</string><key>message</key><string>\n@import &lt;Foundation/Foundation.j&gt;@implementation AppController : CPObject{CPWindow theWindow;}@end\
\n ^\
\nWARNING line 1 in file:" + rootDirectory + "/objjWarningTestFile.j:1: Unknown type &apos;CPWindow&apos; for ivar &apos;theWindow&apos;</string></dict></array></plist>\n" equals:status message:"objj failed"];
\nWARNING line 1 in file:" + rootDirectory + "/objjWarningTestFile.j:1: Unknown type &apos;CPWindow&apos; for ivar &apos;theWindow&apos;</string></dict></array></plist>\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 <Cocoa/Cocoa.h>\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"];