Skip to content

Ejhfast/TypedJS

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

21 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

TypedJS

Basic, automatic JavaScript testing. Requires jQuery. This is just a start. TypedJS will soon provide more complex forms of program specification, and analysis. The goal: safe, correct JavaScript.

(Warning: In need of some refactoring).

Usage

First, annotate your javascript functions with Haskell-like type signatures:

//+ char_first :: Char -> Char -> Char

function char_first(c1,c2){
  return c1;
}

//+ my_prop :: {name:String, valid:Boolean} -> Boolean

function my_prop(obj){
  if(obj.valid === true){
    return "true"; // Error, we are 
  }                // returning a string here
  else{
    return obj.valid;
  }
};

Then load your JavaScript file in a browser window and run:

TypedJS.run_tests()

License

Attribution-NonCommercial 3.0 Unported (CC BY-NC 3.0)

About

Lightweight program specifications for testing JavaScript

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •