Fixed: The tool ojtest now works with the new Node version.

This commit is contained in:
Martin Carlberg committed 2021-09-03 14:31:11 +02:00
1 parent 9c2f37b43f
commit a893f3f5c1
7 files changed
+43 -24

No files matched your search

+13
View File
@@ -0,0 +1,13 @@
#!/usr/bin/env node
ObjectiveJ = require("@objj/runtime");
//CAPPUCCINO = require("@objj/cappuccino");
var ojtest = require("@objj/ojtest");
// Inject path to the OJTest main Objective-J file into the arguments so it is the file to be executed.
var args = process.argv.slice(); // Copy
args.splice(1, 1, ojtest.pathToOJTest);
// Compile, load and run it
ObjectiveJ.run(args);
+7 -8
View File
@@ -2,7 +2,7 @@ require("./common.jake");
var fs = require('fs');
var path = require('path');
var child_process = require("child_process");
var childProcess = require("child_process");
const term = ObjectiveJ.term;
const utilsFile = ObjectiveJ.utils.file;
@@ -10,8 +10,8 @@ const utilsFile = ObjectiveJ.utils.file;
var subprojects = ["Objective-J", "CommonJS", "Foundation", "AppKit", "Tools"];
task ("build", function() {
child_process.execSync("mkdir -p $CAPP_BUILD", {stdio: 'inherit'});
child_process.execSync("ln -sf $PWD/node_modules $CAPP_BUILD/node_modules", {stdio: 'inherit'});
childProcess.execSync("mkdir -p $CAPP_BUILD", {stdio: 'inherit'});
childProcess.execSync("ln -sf $PWD/node_modules $CAPP_BUILD/node_modules", {stdio: 'inherit'});
});
["build", "clean", "clobber"].forEach(function(aTaskName)
@@ -338,12 +338,11 @@ task("test", ["CommonJS", "test-only"]);
task("test-only", function()
{
var tests = new FileList('Tests/**/*Test.j'),
cmd = ["ojtest"].concat(tests.items()),
code = OS.system(serializedENV() + " " + cmd.map(OS.enquote).join(" "));
var tests = new FileList('Tests/**/*Test.j');
var cmd = ["ojtest"].concat(tests.items());
var cmdString = cmd.map(utilsFile.enquote).join(" ");
if (code !== 0)
OS.exit(code);
childProcess.execSync(cmdString);
});
task("check-missing-imports", function()
+4 -4
View File
@@ -24,10 +24,10 @@ var undefined;
if (typeof window !== "undefined")
{
window.setNativeTimeout = window.setTimeout;
window.clearNativeTimeout = window.clearTimeout;
window.setNativeInterval = window.setInterval;
window.clearNativeInterval = window.clearInterval;
window.setNativeTimeout = window.setTimeout || setTimeout;
window.clearNativeTimeout = window.clearTimeout || clearTimeout;
window.setNativeInterval = window.setInterval || setInterval;
window.clearNativeInterval = window.clearInterval || clearInterval;
}
// Objective-J Constants
+2
View File
@@ -1,6 +1,8 @@
@import <AppKit/CPButton.j>
@import <AppKit/CPApplication.j>
@import <AppKit/CPText.j>
@import <AppKit/CPRadio.j>
@import <AppKit/CPObjectController.j>
@implementation CPButtonTest : OJTestCase
{
+3 -2
View File
@@ -1,4 +1,5 @@
var FILE = require("file");
var fs = require("fs");
var path = require("path");
@import <Foundation/CPArray.j>
@import <Foundation/CPString.j>
@@ -173,7 +174,7 @@ var ELEMENTS = 100,
- (CPArray)makeRandomText
{
var the_big_sort = FILE.read(FILE.join(FILE.dirname(module.path), "the_big_sort.txt"), { charset:"UTF-8" }),
var the_big_sort = fs.readFileSync(path.join(path.dirname(__filename), "the_big_sort.txt"), {encoding: 'utf-8'}),
words = the_big_sort.split(" ", ELEMENTS),
wordcount = words.length,
array = [];
+11 -8
View File
@@ -1,24 +1,26 @@
@global module
var FILE = require("file"),
FileList = require("jake").FileList;
var fs = require("fs"),
path = require("path"),
FileList = ObjectiveJ.utils.filelist.FileList;
@implementation CFPropertyListTest : OJTestCase
- (void)testFormatSniffing
{
var XMLPropertyLists = new FileList(FILE.join(FILE.dirname(module.path), "PropertyLists", "XML-*.plist"));
debugger;
var XMLPropertyLists = new FileList(path.join(path.dirname(__filename), "PropertyLists", "XML-*.plist"));
XMLPropertyLists.forEach(function(/*String*/ aPath)
{
[self assert:CFPropertyList.FormatXML_v1_0 equals:CFPropertyList.sniffedFormatOfString(FILE.read(aPath))];
[self assert:CFPropertyList.FormatXML_v1_0 equals:CFPropertyList.sniffedFormatOfString(fs.readFileSync(aPath).toString())];
});
}
- (void)testDateDeserialization
{
var path = FILE.join(FILE.dirname(module.path), "PropertyLists/XMLDate.plist"),
object = CFPropertyList.readPropertyListFromFile(path),
var p = path.join(path.dirname(__filename), "PropertyLists/XMLDate.plist"),
object = CFPropertyList.readPropertyListFromFile(p),
date = [object objectForKey:@"date"];
[self assert:[CPDate class] equals:[date class]];
@@ -45,7 +47,8 @@ var FILE = require("file"),
}
}
- (void)testPropertyListFromXMLShouldHandleEmptiestXMLGracefully {
// This is removed as the Node module xmldom/xmldom will print out an error (will not fail) when the xml string is empty
/*- (void)testPropertyListFromXMLShouldHandleEmptiestXMLGracefully {
// rhino can't parse empty XML documents
if (system.engine !== "rhino") {
var XML = "",
@@ -53,7 +56,7 @@ var FILE = require("file"),
[self assert:object equals:null];
}
}
}*/
- (void)testPropertyListFromXMLShouldParseNiceAndCleanXML {
var XML = "<?xml version=\"1.0\" encoding=\"UTF-8\"?><!DOCTYPE plist PUBLIC \"-//Apple//DTD PLIST 1.0//EN\" \"http://www.apple.com/DTDs/PropertyList-1.0.dtd\"><plist version=\"1.0\"><dict><key>Main cib file base name</key><string>MainMenu.cib</string><key>CPBundleName</key><string>CopyAndPaste</string><key>CPBundleVersion</key><string>1.0</string><key>CPHumanReadableCopyright</key><string>Copyright \u00a9 2013, SlevenBits, Ltd. All rights reserved.</string></dict></plist>",
+3 -2
View File
@@ -1,13 +1,14 @@
{
"name": "@objj/cappuccino",
"version": "1.1.1",
"version": "1.1.3",
"devDependencies": {
"terser": "^5.7.0",
"@objj/cappuccino": "file:."
},
"dependencies": {
"@objj/jake": "latest",
"@objj/runtime": "latest"
"@objj/runtime": "latest",
"@objj/ojtest": "latest"
},
"files": [
"dist",