Skip to content

pontuslaestadius/js-irt

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

19 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

js-irt

JavaScript - Inline Rust Testing

What is this?

Small and simple program which allows for Rust-like inline tests in .js files.

Examples

Create a simple.js file.

/// ```
/// let a = 50;
/// assert_eq!(add(1, 1), 2);
/// assert_eq!(add(a, 1), 51);
/// assert_eq!(add(a, 50), 100);
/// ```
function add(a, b) {
    return a + b;
}

Run the program with the input file.

cargo run simple.js

The result:

test simple.js - assert_eq!(add(1, 1), 2); ... ok
test simple.js - assert_eq!(add(99, 1), 100); ... ok
test simple.js - assert_eq!(add(50, 50), 99); ... FAILED

Why?

because.

About

JavaScript - Inline Rust Testing

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published