limadelic / decaf Goto Github PK
View Code? Open in Web Editor NEWslim in coffeescript
slim in coffeescript
Hi,
I have followed: #5
and changed my COMMAND_PATTERN=decaf %p
(running on OSX)
Everything else is the same as in https://github.com/limadelic/decaf/wiki/Hello-Decaf
When running http://localhost:8080/HelloDecafTest?test i get:
Could not complete testing: fitnesse.slim.SlimError: Error SLiM server died before a connection could be established. env: coffee: No such file or directory
I have been creating my Fitnesse Functions with the following syntax in JavaScript.
| import |
| logic |
|DT:logic|
|a|b|and?|
|0|0|0|
|0|1|0|
|1|0|0|
|1|1|1|
and in a JS file called logic.js
'use strict';
function logic() {}
logic.prototype.setA = function(a) {
this.a = a;
};
logic.prototype.setB = function(b) {
this.b = b;
};
logic.prototype.and = function() {
return this.a & this.b;
};
module.exports.logic = logic;
I have been wanting to use ES6 classes for my fixures. Below is an attempt...
'use strict';
class logic {
constructor() {
//
}
setA(a) {
this.a = a;
}
setB(b) {
this.b = b;
}
and() {
return this.a & this.b;
}
}
module.exports.logic = logic;
However, I get the following errors
I am a little confused because the 'class' keyword is just syntactic sugar. So, perhaps my syntax is wrong.
Has anyone been able to get ES6 classes to work? If so, what syntax are you using?
Thanks
Hello,
running a test suite sometimes aborts if the data event is fired with only a part of the data written from the SLIM client.
Below is a possible patch. However, checking for completeness ist not perfect. isComplete should actually try to deserialize the message and only if that succeeds continue.
diff --git a/node_modules/decaf/src/server.coffee b/node_modules/decaf/src/server.coffee
index 0055f0b..7d2ef39 100644
--- a/node_modules/decaf/src/server.coffee
+++ b/node_modules/decaf/src/server.coffee
@@ -10,14 +10,24 @@ class exports.Server
listen: (@socket) =>
@processor = new Processor @socket
@socket.write @hello
+ @old_data = ''
@socket.on 'data', @message
-
- message: (data) =>
- command = @command_from data
-
- if command is 'bye'
- then @exit()
- else @processor.run command
+
+ isComplete: (data) ->
+ lastChars = data[-2..]
+ return lastChars==":]" or lastChars=="ye"
+
+ message: (new_data) =>
+ data = @old_data + new_data
+ if not this.isComplete(data)
+ @old_data = data
+ else
+ @old_data = ''
+ command = @command_from data
+
+ if command is 'bye'
+ then @exit()
+ else @processor.run command
command_from: (data) -> data[7..].toString()
Followed the README instructions, installed Decaf, but am getting this error when trying to run the fixture:
Unable to start test system 'slim': java.io.IOException: Cannot run program "decaf.cmd": error=2, No such file or directory
Any ideas?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.