Giter Site home page Giter Site logo

decaf's Introduction

							       ___                                .-.     
							      (   )                              /    \   
							    .-.| |    .--.     .--.      .---.   | .`. ;  
                               /   \ |   /    \   /    \    / .-, \  | |(___) 
         _..,----,.._         |  .-. |  |  .-. ; |  .-. ;  (__) ; |  | |_     
      .-;'-.,____,.-';        | |  | |  |  | | | |  |(___)   .'`  | (   __)   
     (( |            |        | |  | |  |  |/  | |  |       / .'| |  | |      
      `))            ;        | |  | |  |  ' _.' |  | ___  | /  | |  | |      
       ` \          /         | '  | |  |  .'.-. |  '(   ) ; |  ; |  | |      
      .-' `,.____.,' '-.      ' `-'  /  '  `-' / '  `-' |  ' `-'  |  | |      
     (     '------'     )      `.__,'    `.__.'   `.__,'   `.__.'_. (___)
      `-=..________..--'

Decaf

This package provides a SliM server implementing the FitNesse SliM protocol. It allows you to write test fixtures in CoffeeScript or JavaScript, and invoke them from a FitNesse test.

Setup

Put these commands in a parent of the Decaf test pages.

!define TEST_SYSTEM {slim}
!define COMMAND_PATTERN {decaf %p}

decaf's People

Contributors

mbarchfe avatar msuarz avatar prime8 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

decaf's Issues

Possible ES6 class support?

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

screenshot from 2016-02-02 09-06-26

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

Error: Decaf.cmd not found

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?

Running a test suite sometimes aborts

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()

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.