Skip to main content

CFML

Status

Beta

Versions

Lucee v5.2

Test Frameworks

TestBox v3

Example

The solution and the tests are written to Solution.cfc and SolutionTest.cfc respectively. Optional preloaded code is written to Preloaded.cfc if given.

component {
  function add(required a, required b) {
    return a + b;
  }
}
component {
  function add(required a, required b) {
    return a + b;
  }
}
component extends="CodewarsBaseSpec" {
  function beforeAll(){
    SUT = createObject( 'Solution' );
  }

  function run(){
    describe( "Example", function(){
      it( 'add(a, b) returns sum', function(){
        expect( SUT.add(1, 1) ).toBe( 2 );
      });
    });
  }
}
component extends="CodewarsBaseSpec" {
  function beforeAll(){
    SUT = createObject( 'Solution' );
  }

  function run(){
    describe( "Example", function(){
      it( 'add(a, b) returns sum', function(){
        expect( SUT.add(1, 1) ).toBe( 2 );
      });
    });
  }
}

CodewarsBaseSpec allows grouping debugging outputs under the relevant test case.

Timeout

16 seconds

Packages

None

Services

None

Language ID

cfml