Note: This guide assumes you have Dart SDK and stagehand installed.
-
Create a new project structure for the code.
(Assuming the project is named
new_kata
)mkdir new_kata cd new_kata stagehand package-simple pub get
-
Modify the generated implementation file (
new_kata\test\new_kata_test.dart
) with the following content:import 'package:new_kata/new_kata.dart'; import 'package:test/test.dart'; void main() { group('Coding Dojo Test Suite', () { KataLib library; setUp(() { library = KataLib(); }); test('Simple Addition Test', () { expect(library.add(1, 2), 3); }); }); }
-
Modify the generated implementation file (
new_kata\lib\src\new_kata_base.dart
) with the following content:class KataLib { int add(int x, int y) => x + y; }
-
Run the test.
pub run test
You should see something like this:
00:04 +1: All tests passed!
Checkout the Dart Language Tour to know more about the language.