diff --git a/.dart_tool/package_config.json b/.dart_tool/package_config.json new file mode 100644 index 0000000..46168a4 --- /dev/null +++ b/.dart_tool/package_config.json @@ -0,0 +1,320 @@ +{ + "configVersion": 2, + "packages": [ + { + "name": "_fe_analyzer_shared", + "rootUri": "file:///C:/Users/erico/AppData/Roaming/Pub/Cache/hosted/pub.dartlang.org/_fe_analyzer_shared-2.2.0", + "packageUri": "lib/", + "languageVersion": "2.2" + }, + { + "name": "analyzer", + "rootUri": "file:///C:/Users/erico/AppData/Roaming/Pub/Cache/hosted/pub.dartlang.org/analyzer-0.39.7", + "packageUri": "lib/", + "languageVersion": "2.6" + }, + { + "name": "args", + "rootUri": "file:///C:/Users/erico/AppData/Roaming/Pub/Cache/hosted/pub.dartlang.org/args-1.6.0", + "packageUri": "lib/", + "languageVersion": "2.3" + }, + { + "name": "async", + "rootUri": "file:///C:/Users/erico/AppData/Roaming/Pub/Cache/hosted/pub.dartlang.org/async-2.4.1", + "packageUri": "lib/", + "languageVersion": "2.2" + }, + { + "name": "boolean_selector", + "rootUri": "file:///C:/Users/erico/AppData/Roaming/Pub/Cache/hosted/pub.dartlang.org/boolean_selector-2.0.0", + "packageUri": "lib/", + "languageVersion": "2.4" + }, + { + "name": "charcode", + "rootUri": "file:///C:/Users/erico/AppData/Roaming/Pub/Cache/hosted/pub.dartlang.org/charcode-1.1.3", + "packageUri": "lib/", + "languageVersion": "2.0" + }, + { + "name": "collection", + "rootUri": "file:///C:/Users/erico/AppData/Roaming/Pub/Cache/hosted/pub.dartlang.org/collection-1.14.12", + "packageUri": "lib/", + "languageVersion": "2.0" + }, + { + "name": "convert", + "rootUri": "file:///C:/Users/erico/AppData/Roaming/Pub/Cache/hosted/pub.dartlang.org/convert-2.1.1", + "packageUri": "lib/", + "languageVersion": "1.17" + }, + { + "name": "coverage", + "rootUri": "file:///C:/Users/erico/AppData/Roaming/Pub/Cache/hosted/pub.dartlang.org/coverage-0.13.9", + "packageUri": "lib/", + "languageVersion": "2.7" + }, + { + "name": "crypto", + "rootUri": "file:///C:/Users/erico/AppData/Roaming/Pub/Cache/hosted/pub.dartlang.org/crypto-2.1.4", + "packageUri": "lib/", + "languageVersion": "2.1" + }, + { + "name": "csslib", + "rootUri": "file:///C:/Users/erico/AppData/Roaming/Pub/Cache/hosted/pub.dartlang.org/csslib-0.16.1", + "packageUri": "lib/", + "languageVersion": "2.1" + }, + { + "name": "glob", + "rootUri": "file:///C:/Users/erico/AppData/Roaming/Pub/Cache/hosted/pub.dartlang.org/glob-1.2.0", + "packageUri": "lib/", + "languageVersion": "2.1" + }, + { + "name": "html", + "rootUri": "file:///C:/Users/erico/AppData/Roaming/Pub/Cache/hosted/pub.dartlang.org/html-0.14.0+3", + "packageUri": "lib/", + "languageVersion": "2.3" + }, + { + "name": "http", + "rootUri": "file:///C:/Users/erico/AppData/Roaming/Pub/Cache/hosted/pub.dartlang.org/http-0.12.1", + "packageUri": "lib/", + "languageVersion": "2.4" + }, + { + "name": "http_multi_server", + "rootUri": "file:///C:/Users/erico/AppData/Roaming/Pub/Cache/hosted/pub.dartlang.org/http_multi_server-2.2.0", + "packageUri": "lib/", + "languageVersion": "2.1" + }, + { + "name": "http_parser", + "rootUri": "file:///C:/Users/erico/AppData/Roaming/Pub/Cache/hosted/pub.dartlang.org/http_parser-3.1.4", + "packageUri": "lib/", + "languageVersion": "2.3" + }, + { + "name": "io", + "rootUri": "file:///C:/Users/erico/AppData/Roaming/Pub/Cache/hosted/pub.dartlang.org/io-0.3.4", + "packageUri": "lib/", + "languageVersion": "2.0" + }, + { + "name": "js", + "rootUri": "file:///C:/Users/erico/AppData/Roaming/Pub/Cache/hosted/pub.dartlang.org/js-0.6.1+1", + "packageUri": "lib/", + "languageVersion": "1.19" + }, + { + "name": "logging", + "rootUri": "file:///C:/Users/erico/AppData/Roaming/Pub/Cache/hosted/pub.dartlang.org/logging-0.11.4", + "packageUri": "lib/", + "languageVersion": "2.0" + }, + { + "name": "matcher", + "rootUri": "file:///C:/Users/erico/AppData/Roaming/Pub/Cache/hosted/pub.dartlang.org/matcher-0.12.6", + "packageUri": "lib/", + "languageVersion": "2.2" + }, + { + "name": "meta", + "rootUri": "file:///C:/Users/erico/AppData/Roaming/Pub/Cache/hosted/pub.dartlang.org/meta-1.1.8", + "packageUri": "lib/", + "languageVersion": "1.12" + }, + { + "name": "mime", + "rootUri": "file:///C:/Users/erico/AppData/Roaming/Pub/Cache/hosted/pub.dartlang.org/mime-0.9.6+3", + "packageUri": "lib/", + "languageVersion": "2.0" + }, + { + "name": "multi_server_socket", + "rootUri": "file:///C:/Users/erico/AppData/Roaming/Pub/Cache/hosted/pub.dartlang.org/multi_server_socket-1.0.2", + "packageUri": "lib/", + "languageVersion": "2.0" + }, + { + "name": "node_interop", + "rootUri": "file:///C:/Users/erico/AppData/Roaming/Pub/Cache/hosted/pub.dartlang.org/node_interop-1.0.3", + "packageUri": "lib/", + "languageVersion": "2.0" + }, + { + "name": "node_io", + "rootUri": "file:///C:/Users/erico/AppData/Roaming/Pub/Cache/hosted/pub.dartlang.org/node_io-1.0.1+2", + "packageUri": "lib/", + "languageVersion": "2.1" + }, + { + "name": "node_preamble", + "rootUri": "file:///C:/Users/erico/AppData/Roaming/Pub/Cache/hosted/pub.dartlang.org/node_preamble-1.4.8", + "packageUri": "lib/", + "languageVersion": "1.24" + }, + { + "name": "package_config", + "rootUri": "file:///C:/Users/erico/AppData/Roaming/Pub/Cache/hosted/pub.dartlang.org/package_config-1.9.3", + "packageUri": "lib/", + "languageVersion": "2.7" + }, + { + "name": "path", + "rootUri": "file:///C:/Users/erico/AppData/Roaming/Pub/Cache/hosted/pub.dartlang.org/path-1.7.0", + "packageUri": "lib/", + "languageVersion": "2.0" + }, + { + "name": "pedantic", + "rootUri": "file:///C:/Users/erico/AppData/Roaming/Pub/Cache/hosted/pub.dartlang.org/pedantic-1.9.0", + "packageUri": "lib/", + "languageVersion": "2.1" + }, + { + "name": "pool", + "rootUri": "file:///C:/Users/erico/AppData/Roaming/Pub/Cache/hosted/pub.dartlang.org/pool-1.4.0", + "packageUri": "lib/", + "languageVersion": "2.0" + }, + { + "name": "pub_semver", + "rootUri": "file:///C:/Users/erico/AppData/Roaming/Pub/Cache/hosted/pub.dartlang.org/pub_semver-1.4.4", + "packageUri": "lib/", + "languageVersion": "2.0" + }, + { + "name": "shelf", + "rootUri": "file:///C:/Users/erico/AppData/Roaming/Pub/Cache/hosted/pub.dartlang.org/shelf-0.7.5", + "packageUri": "lib/", + "languageVersion": "2.0" + }, + { + "name": "shelf_packages_handler", + "rootUri": "file:///C:/Users/erico/AppData/Roaming/Pub/Cache/hosted/pub.dartlang.org/shelf_packages_handler-2.0.0", + "packageUri": "lib/", + "languageVersion": "2.0" + }, + { + "name": "shelf_static", + "rootUri": "file:///C:/Users/erico/AppData/Roaming/Pub/Cache/hosted/pub.dartlang.org/shelf_static-0.2.8", + "packageUri": "lib/", + "languageVersion": "2.0" + }, + { + "name": "shelf_web_socket", + "rootUri": "file:///C:/Users/erico/AppData/Roaming/Pub/Cache/hosted/pub.dartlang.org/shelf_web_socket-0.2.3", + "packageUri": "lib/", + "languageVersion": "2.0" + }, + { + "name": "source_map_stack_trace", + "rootUri": "file:///C:/Users/erico/AppData/Roaming/Pub/Cache/hosted/pub.dartlang.org/source_map_stack_trace-2.0.0", + "packageUri": "lib/", + "languageVersion": "2.7" + }, + { + "name": "source_maps", + "rootUri": "file:///C:/Users/erico/AppData/Roaming/Pub/Cache/hosted/pub.dartlang.org/source_maps-0.10.9", + "packageUri": "lib/", + "languageVersion": "2.0" + }, + { + "name": "source_span", + "rootUri": "file:///C:/Users/erico/AppData/Roaming/Pub/Cache/hosted/pub.dartlang.org/source_span-1.7.0", + "packageUri": "lib/", + "languageVersion": "2.6" + }, + { + "name": "stack_trace", + "rootUri": "file:///C:/Users/erico/AppData/Roaming/Pub/Cache/hosted/pub.dartlang.org/stack_trace-1.9.3", + "packageUri": "lib/", + "languageVersion": "1.23" + }, + { + "name": "stream_channel", + "rootUri": "file:///C:/Users/erico/AppData/Roaming/Pub/Cache/hosted/pub.dartlang.org/stream_channel-2.0.0", + "packageUri": "lib/", + "languageVersion": "2.0" + }, + { + "name": "string_scanner", + "rootUri": "file:///C:/Users/erico/AppData/Roaming/Pub/Cache/hosted/pub.dartlang.org/string_scanner-1.0.5", + "packageUri": "lib/", + "languageVersion": "2.0" + }, + { + "name": "term_glyph", + "rootUri": "file:///C:/Users/erico/AppData/Roaming/Pub/Cache/hosted/pub.dartlang.org/term_glyph-1.1.0", + "packageUri": "lib/", + "languageVersion": "1.8" + }, + { + "name": "test", + "rootUri": "file:///C:/Users/erico/AppData/Roaming/Pub/Cache/hosted/pub.dartlang.org/test-1.14.2", + "packageUri": "lib/", + "languageVersion": "2.7" + }, + { + "name": "test_api", + "rootUri": "file:///C:/Users/erico/AppData/Roaming/Pub/Cache/hosted/pub.dartlang.org/test_api-0.2.15", + "packageUri": "lib/", + "languageVersion": "2.4" + }, + { + "name": "test_core", + "rootUri": "file:///C:/Users/erico/AppData/Roaming/Pub/Cache/hosted/pub.dartlang.org/test_core-0.3.3", + "packageUri": "lib/", + "languageVersion": "2.7" + }, + { + "name": "typed_data", + "rootUri": "file:///C:/Users/erico/AppData/Roaming/Pub/Cache/hosted/pub.dartlang.org/typed_data-1.1.6", + "packageUri": "lib/", + "languageVersion": "2.0" + }, + { + "name": "vm_service", + "rootUri": "file:///C:/Users/erico/AppData/Roaming/Pub/Cache/hosted/pub.dartlang.org/vm_service-4.0.2", + "packageUri": "lib/", + "languageVersion": "2.6" + }, + { + "name": "watcher", + "rootUri": "file:///C:/Users/erico/AppData/Roaming/Pub/Cache/hosted/pub.dartlang.org/watcher-0.9.7+15", + "packageUri": "lib/", + "languageVersion": "2.2" + }, + { + "name": "web_socket_channel", + "rootUri": "file:///C:/Users/erico/AppData/Roaming/Pub/Cache/hosted/pub.dartlang.org/web_socket_channel-1.1.0", + "packageUri": "lib/", + "languageVersion": "2.0" + }, + { + "name": "webkit_inspection_protocol", + "rootUri": "file:///C:/Users/erico/AppData/Roaming/Pub/Cache/hosted/pub.dartlang.org/webkit_inspection_protocol-0.5.0+1", + "packageUri": "lib/", + "languageVersion": "2.0" + }, + { + "name": "yaml", + "rootUri": "file:///C:/Users/erico/AppData/Roaming/Pub/Cache/hosted/pub.dartlang.org/yaml-2.2.1", + "packageUri": "lib/", + "languageVersion": "2.4" + }, + { + "name": "dart2_koans", + "rootUri": "../", + "packageUri": "lib/", + "languageVersion": "2.3" + } + ], + "generated": "2020-04-28T18:50:05.627829Z", + "generator": "pub", + "generatorVersion": "2.7.2" +} diff --git a/.dart_tool/pub/bin/sdk-version b/.dart_tool/pub/bin/sdk-version new file mode 100644 index 0000000..37c2961 --- /dev/null +++ b/.dart_tool/pub/bin/sdk-version @@ -0,0 +1 @@ +2.7.2 diff --git a/.dart_tool/pub/bin/test/test.dart.snapshot.dart2 b/.dart_tool/pub/bin/test/test.dart.snapshot.dart2 new file mode 100644 index 0000000..a4b6b4f Binary files /dev/null and b/.dart_tool/pub/bin/test/test.dart.snapshot.dart2 differ diff --git a/.packages b/.packages new file mode 100644 index 0000000..6184777 --- /dev/null +++ b/.packages @@ -0,0 +1,53 @@ +# Generated by pub on 2020-04-28 15:50:05.605846. +_fe_analyzer_shared:file:///C:/Users/erico/AppData/Roaming/Pub/Cache/hosted/pub.dartlang.org/_fe_analyzer_shared-2.2.0/lib/ +analyzer:file:///C:/Users/erico/AppData/Roaming/Pub/Cache/hosted/pub.dartlang.org/analyzer-0.39.7/lib/ +args:file:///C:/Users/erico/AppData/Roaming/Pub/Cache/hosted/pub.dartlang.org/args-1.6.0/lib/ +async:file:///C:/Users/erico/AppData/Roaming/Pub/Cache/hosted/pub.dartlang.org/async-2.4.1/lib/ +boolean_selector:file:///C:/Users/erico/AppData/Roaming/Pub/Cache/hosted/pub.dartlang.org/boolean_selector-2.0.0/lib/ +charcode:file:///C:/Users/erico/AppData/Roaming/Pub/Cache/hosted/pub.dartlang.org/charcode-1.1.3/lib/ +collection:file:///C:/Users/erico/AppData/Roaming/Pub/Cache/hosted/pub.dartlang.org/collection-1.14.12/lib/ +convert:file:///C:/Users/erico/AppData/Roaming/Pub/Cache/hosted/pub.dartlang.org/convert-2.1.1/lib/ +coverage:file:///C:/Users/erico/AppData/Roaming/Pub/Cache/hosted/pub.dartlang.org/coverage-0.13.9/lib/ +crypto:file:///C:/Users/erico/AppData/Roaming/Pub/Cache/hosted/pub.dartlang.org/crypto-2.1.4/lib/ +csslib:file:///C:/Users/erico/AppData/Roaming/Pub/Cache/hosted/pub.dartlang.org/csslib-0.16.1/lib/ +glob:file:///C:/Users/erico/AppData/Roaming/Pub/Cache/hosted/pub.dartlang.org/glob-1.2.0/lib/ +html:file:///C:/Users/erico/AppData/Roaming/Pub/Cache/hosted/pub.dartlang.org/html-0.14.0+3/lib/ +http:file:///C:/Users/erico/AppData/Roaming/Pub/Cache/hosted/pub.dartlang.org/http-0.12.1/lib/ +http_multi_server:file:///C:/Users/erico/AppData/Roaming/Pub/Cache/hosted/pub.dartlang.org/http_multi_server-2.2.0/lib/ +http_parser:file:///C:/Users/erico/AppData/Roaming/Pub/Cache/hosted/pub.dartlang.org/http_parser-3.1.4/lib/ +io:file:///C:/Users/erico/AppData/Roaming/Pub/Cache/hosted/pub.dartlang.org/io-0.3.4/lib/ +js:file:///C:/Users/erico/AppData/Roaming/Pub/Cache/hosted/pub.dartlang.org/js-0.6.1+1/lib/ +logging:file:///C:/Users/erico/AppData/Roaming/Pub/Cache/hosted/pub.dartlang.org/logging-0.11.4/lib/ +matcher:file:///C:/Users/erico/AppData/Roaming/Pub/Cache/hosted/pub.dartlang.org/matcher-0.12.6/lib/ +meta:file:///C:/Users/erico/AppData/Roaming/Pub/Cache/hosted/pub.dartlang.org/meta-1.1.8/lib/ +mime:file:///C:/Users/erico/AppData/Roaming/Pub/Cache/hosted/pub.dartlang.org/mime-0.9.6+3/lib/ +multi_server_socket:file:///C:/Users/erico/AppData/Roaming/Pub/Cache/hosted/pub.dartlang.org/multi_server_socket-1.0.2/lib/ +node_interop:file:///C:/Users/erico/AppData/Roaming/Pub/Cache/hosted/pub.dartlang.org/node_interop-1.0.3/lib/ +node_io:file:///C:/Users/erico/AppData/Roaming/Pub/Cache/hosted/pub.dartlang.org/node_io-1.0.1+2/lib/ +node_preamble:file:///C:/Users/erico/AppData/Roaming/Pub/Cache/hosted/pub.dartlang.org/node_preamble-1.4.8/lib/ +package_config:file:///C:/Users/erico/AppData/Roaming/Pub/Cache/hosted/pub.dartlang.org/package_config-1.9.3/lib/ +path:file:///C:/Users/erico/AppData/Roaming/Pub/Cache/hosted/pub.dartlang.org/path-1.7.0/lib/ +pedantic:file:///C:/Users/erico/AppData/Roaming/Pub/Cache/hosted/pub.dartlang.org/pedantic-1.9.0/lib/ +pool:file:///C:/Users/erico/AppData/Roaming/Pub/Cache/hosted/pub.dartlang.org/pool-1.4.0/lib/ +pub_semver:file:///C:/Users/erico/AppData/Roaming/Pub/Cache/hosted/pub.dartlang.org/pub_semver-1.4.4/lib/ +shelf:file:///C:/Users/erico/AppData/Roaming/Pub/Cache/hosted/pub.dartlang.org/shelf-0.7.5/lib/ +shelf_packages_handler:file:///C:/Users/erico/AppData/Roaming/Pub/Cache/hosted/pub.dartlang.org/shelf_packages_handler-2.0.0/lib/ +shelf_static:file:///C:/Users/erico/AppData/Roaming/Pub/Cache/hosted/pub.dartlang.org/shelf_static-0.2.8/lib/ +shelf_web_socket:file:///C:/Users/erico/AppData/Roaming/Pub/Cache/hosted/pub.dartlang.org/shelf_web_socket-0.2.3/lib/ +source_map_stack_trace:file:///C:/Users/erico/AppData/Roaming/Pub/Cache/hosted/pub.dartlang.org/source_map_stack_trace-2.0.0/lib/ +source_maps:file:///C:/Users/erico/AppData/Roaming/Pub/Cache/hosted/pub.dartlang.org/source_maps-0.10.9/lib/ +source_span:file:///C:/Users/erico/AppData/Roaming/Pub/Cache/hosted/pub.dartlang.org/source_span-1.7.0/lib/ +stack_trace:file:///C:/Users/erico/AppData/Roaming/Pub/Cache/hosted/pub.dartlang.org/stack_trace-1.9.3/lib/ +stream_channel:file:///C:/Users/erico/AppData/Roaming/Pub/Cache/hosted/pub.dartlang.org/stream_channel-2.0.0/lib/ +string_scanner:file:///C:/Users/erico/AppData/Roaming/Pub/Cache/hosted/pub.dartlang.org/string_scanner-1.0.5/lib/ +term_glyph:file:///C:/Users/erico/AppData/Roaming/Pub/Cache/hosted/pub.dartlang.org/term_glyph-1.1.0/lib/ +test:file:///C:/Users/erico/AppData/Roaming/Pub/Cache/hosted/pub.dartlang.org/test-1.14.2/lib/ +test_api:file:///C:/Users/erico/AppData/Roaming/Pub/Cache/hosted/pub.dartlang.org/test_api-0.2.15/lib/ +test_core:file:///C:/Users/erico/AppData/Roaming/Pub/Cache/hosted/pub.dartlang.org/test_core-0.3.3/lib/ +typed_data:file:///C:/Users/erico/AppData/Roaming/Pub/Cache/hosted/pub.dartlang.org/typed_data-1.1.6/lib/ +vm_service:file:///C:/Users/erico/AppData/Roaming/Pub/Cache/hosted/pub.dartlang.org/vm_service-4.0.2/lib/ +watcher:file:///C:/Users/erico/AppData/Roaming/Pub/Cache/hosted/pub.dartlang.org/watcher-0.9.7+15/lib/ +web_socket_channel:file:///C:/Users/erico/AppData/Roaming/Pub/Cache/hosted/pub.dartlang.org/web_socket_channel-1.1.0/lib/ +webkit_inspection_protocol:file:///C:/Users/erico/AppData/Roaming/Pub/Cache/hosted/pub.dartlang.org/webkit_inspection_protocol-0.5.0+1/lib/ +yaml:file:///C:/Users/erico/AppData/Roaming/Pub/Cache/hosted/pub.dartlang.org/yaml-2.2.1/lib/ +dart2_koans:lib/ diff --git a/AUTHORS b/AUTHORS index 6a3b3c5..d759edd 100644 --- a/AUTHORS +++ b/AUTHORS @@ -6,3 +6,4 @@ Matthew Butler Chris Buckett +Eric Omine diff --git a/README.md b/README.md index cb06888..33575ea 100644 --- a/README.md +++ b/README.md @@ -26,13 +26,19 @@ in the pub-cache and more difficult location for editing properly. Usage ----- -First you must make sure you have, at the least, the Dart VM +First you must make sure you have the Dart SDK installed on your computer and working. If you're unsure about this process please see the [Dart download](http://www.dartlang.org/downloads.html). -From the command line use the dartVM to run the file: - dart bin/dart_koans.dart +To run all tests, run: + + pub run test + + +To run a single test file, run e.g.: + + pub run test ./test/boolean_test.dart You should receive an error letting you know where your path to enlightenment is currently blocked. From there, edit the file diff --git a/bin/dart_koans.dart b/bin/dart_koans.dart deleted file mode 100755 index ec7f5f1..0000000 --- a/bin/dart_koans.dart +++ /dev/null @@ -1,27 +0,0 @@ -library dart_koans; - -import 'package:unittest/unittest.dart'; -import 'package:dart_koans/src/config_koans.dart'; - -import 'dart:isolate'; - -part 'package:dart_koans/numbers.dart'; -part 'package:dart_koans/boolean.dart'; -part 'package:dart_koans/strings.dart'; -part 'package:dart_koans/objects.dart'; -part 'package:dart_koans/lists.dart'; - -const _____ = ''; - -void main() { - // Setup configuration for unittest - var unitConf = new ConfigKoans(); - unittestConfiguration = unitConf; - - start_here(); - using_boolean(); - using_strings(); - using_objects(); - using_lists(); - -} \ No newline at end of file diff --git a/lib/src/config_colors.dart b/lib/src/config_colors.dart deleted file mode 100644 index 83e1cfd..0000000 --- a/lib/src/config_colors.dart +++ /dev/null @@ -1,76 +0,0 @@ -library colors; - -const int RESET = 0; -const int BOLD = 1; - -const int FG_BLACK = 30; -const int FG_RED = 31; -const int FG_GREEN = 32; -const int FG_YELLOW = 33; -const int FG_BLUE = 34; -const int FG_MAGENTA = 35; -const int FG_CYAN = 36; -const int FG_WHITE = 37; - -const int BG_BLACK = 40; -const int BG_RED = 41; -const int BG_GREEN = 42; -const int BG_YELLOW = 43; -const int BG_BLUE = 44; -const int BG_MAGENTA = 45; -const int BG_CYAN = 46; -const int BG_WHITE = 47; - -/// Determine if ansi colors are generated -var useAnsi = false; - -String _formatString(String str, int color, bool bold) { - var strOut; - if(useAnsi) { - String stCd = new String.fromCharCodes([27, 91]); - strOut = '${stCd}${bold ? '01' : ''};${color}m$str${stCd}${RESET}m'; - } else { - strOut = str; - } - return strOut; -} - - /** Returns string [arg] with light (or bold) red text */ -String LT_RED(String arg) => _formatString(arg, FG_RED, true); - /** Returns string [arg] with dark red text */ -String DK_RED(String arg) => _formatString(arg, FG_RED, false); - - /** Returns string [arg] with light (or bold) green text */ -String LT_GREEN(String arg) => _formatString(arg, FG_GREEN, true); - /** Returns string [arg] with dark green text */ -String DK_GREEN(String arg) => _formatString(arg, FG_GREEN, false); - - /** Returns string [arg] with light (or bold) yellow text */ -String LT_YELLOW(String arg) => _formatString(arg, FG_YELLOW, true); - /** Returns string [arg] with dark yellow text */ -String DK_YELLOW(String arg) => _formatString(arg, FG_YELLOW, false); - - /** Returns string [arg] with light (or bold) blue text */ -String LT_BLUE(String arg) => _formatString(arg, FG_BLUE, true); - /** Returns string [arg] with dark blue text */ -String DK_BLUE(String arg) => _formatString(arg, FG_BLUE, false); - - /** Returns string [arg] with light (or bold) magenta text */ -String LT_MAGENTA(String arg) => _formatString(arg, FG_MAGENTA, true); - /** Returns string [arg] with dark magenta text */ -String DK_MAGENTA(String arg) => _formatString(arg, FG_MAGENTA, false); - - /** Returns string [arg] with light (or bold) cyan text */ -String LT_CYAN(String arg) => _formatString(arg, FG_CYAN, true); - /** Returns string [arg] with dark cyan (teal) text */ -String DK_CYAN(String arg) => _formatString(arg, FG_CYAN, false); - - /** Returns string [arg] with light (or bold) white text */ -String LT_WHITE(String arg) => _formatString(arg, FG_WHITE, true); - /** Returns string [arg] with dark white (light gray) text */ -String DK_WHITE(String arg) => _formatString(arg, FG_WHITE, false); - - /** Returns string [arg] with light (or bold) black (dark grey) text */ -String LT_BLACK(String arg) => _formatString(arg, FG_BLACK, true); - /** Returns string [arg] with dark black text */ -String DK_BLACK(String arg) => _formatString(arg, FG_BLACK, false); diff --git a/lib/src/config_koans.dart b/lib/src/config_koans.dart deleted file mode 100644 index d40cdcb..0000000 --- a/lib/src/config_koans.dart +++ /dev/null @@ -1,129 +0,0 @@ -library koans_config; - -import 'package:unittest/unittest.dart' as ut; -import 'package:path/path.dart' as path; -import 'config_colors.dart' as colors; -import 'dart:io'; - -const _____ = ''; - -/// A [Matcher] that matches any [Object] instance -const ut.Matcher isObject = const myInstanceOf('Object'); - -/// A [Matcher] that matches any [bool] instance -const ut.Matcher isBool = const myInstanceOf('bool'); - -/// A [Matcher] that matches any [num] instance -const ut.Matcher isNum = const myInstanceOf('num'); - -/// A [Matcher] that matches any [int] instance -const ut.Matcher isInt = const myInstanceOf('int'); - -/// A [Matcher] that matches any [double] instance -const ut.Matcher isDouble = const myInstanceOf('double'); - -/// A [Matcher] that matches any [String] instance -const ut.Matcher isString = const myInstanceOf('String'); - -/// A [Matcher] that matches any [List] instance -//const ut.Matcher isList = const myInstanceOf('List'); - -/// A [Matcher] that matches any non [bool] instance -const ut.Matcher isNotBool = const isNotInstanceOf('bool'); - -/// A [Matcher] that matches any non [num] instance -const ut.Matcher isNotNum = const isNotInstanceOf('num'); - -/// A [Matcher] that matches any non [int] instance -const ut.Matcher isNotInt = const isNotInstanceOf('int'); - -/// A [Matcher] that matches any non [double] instance -const ut.Matcher isNotDouble = const isNotInstanceOf('double'); - -/// A [Matcher] that matches any non [num] instance -const ut.Matcher isNotString = const isNotInstanceOf('String'); - -class myInstanceOf extends ut.isInstanceOf { - final String _name; - - const myInstanceOf([name = 'specified type']): _name = name; - - bool matches(obj, Map matchState) { - if(obj == _____) return false; - return obj is T; - } - // The description here is lame :-( - ut.Description describe(ut.Description description) => - description.add('an instance of ${_name}'); -} - -class isNotInstanceOf extends ut.isInstanceOf { - final String _name; - const isNotInstanceOf([name = 'specified type']) : this._name = name; - bool matches(obj, Map matchState) { - if(obj == _____) return false; - return obj is! T; - } - // The description here is lame :-( - ut.Description describe(ut.Description description) => - description.add('not an instance of ${_name}'); -} - - -class ConfigKoans extends ut.SimpleConfiguration { - final LIB_DIR = 'lib/'; - - ConfigKoans() { - var osStr = Platform.operatingSystem; - if(osStr != 'windows') { - colors.useAnsi = true; - } - } - - String get name => 'Koans'; - - void onStart() { - print('\n\t\t${colors.LT_WHITE('Dart Koans')}\n'); - print('Beginning the path to enlightenment...'); - } - - void onSummary(int passed, int failed, int errors, List results, - String uncaughtError) { - var total = passed + failed + errors; - print('Progress: ${colors.DK_GREEN('$passed tests have been passed')}. ' - '${colors.DK_RED('${total - passed} remain.')}\n'); - if(failed > 0) { - var fail; - for(var test in results) { - if(test.result == 'fail' || test.result == 'error') { - fail = test; - break; - } - } - - var failLines = fail.stackTrace.toString().trim().split('\n'); - var failLine = failLines.firstWhere((el) { - return el.contains('dart_koans'); - }); - var components = failLine.split('/').last; - components = components.split(' '); - var fileName = components[0]; - components = components[1].split(':'); - var context = new path.Context(current: LIB_DIR); - - print('Failed at: ${colors.DK_YELLOW(fail.description)}'); - print(fail.message); - print('Seek your answers in File:'); - print('${colors.DK_MAGENTA(context.join(context.current ,fileName)) } ' - '(Line: ${components[0]} Column: ${components[1]})\n'); - } - - if(errors + failed != 0) { - print('You have not yet reached enlightenment.'); - } else { - print('Congradulations! You\'ve reached enlightenment'); - } - - exit(0); - } -} diff --git a/pubspec.lock b/pubspec.lock index 8065dd4..2e03c89 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -1,19 +1,362 @@ # Generated by pub -# See http://pub.dartlang.org/doc/glossary.html#lockfile +# See https://dart.dev/tools/pub/glossary#lockfile packages: + _fe_analyzer_shared: + dependency: transitive + description: + name: _fe_analyzer_shared + url: "https://pub.dartlang.org" + source: hosted + version: "2.2.0" + analyzer: + dependency: transitive + description: + name: analyzer + url: "https://pub.dartlang.org" + source: hosted + version: "0.39.7" + args: + dependency: transitive + description: + name: args + url: "https://pub.dartlang.org" + source: hosted + version: "1.6.0" + async: + dependency: transitive + description: + name: async + url: "https://pub.dartlang.org" + source: hosted + version: "2.4.1" + boolean_selector: + dependency: transitive + description: + name: boolean_selector + url: "https://pub.dartlang.org" + source: hosted + version: "2.0.0" + charcode: + dependency: transitive + description: + name: charcode + url: "https://pub.dartlang.org" + source: hosted + version: "1.1.3" + collection: + dependency: transitive + description: + name: collection + url: "https://pub.dartlang.org" + source: hosted + version: "1.14.12" + convert: + dependency: transitive + description: + name: convert + url: "https://pub.dartlang.org" + source: hosted + version: "2.1.1" + coverage: + dependency: transitive + description: + name: coverage + url: "https://pub.dartlang.org" + source: hosted + version: "0.13.9" + crypto: + dependency: transitive + description: + name: crypto + url: "https://pub.dartlang.org" + source: hosted + version: "2.1.4" + csslib: + dependency: transitive + description: + name: csslib + url: "https://pub.dartlang.org" + source: hosted + version: "0.16.1" + glob: + dependency: transitive + description: + name: glob + url: "https://pub.dartlang.org" + source: hosted + version: "1.2.0" + html: + dependency: transitive + description: + name: html + url: "https://pub.dartlang.org" + source: hosted + version: "0.14.0+3" + http: + dependency: transitive + description: + name: http + url: "https://pub.dartlang.org" + source: hosted + version: "0.12.1" + http_multi_server: + dependency: transitive + description: + name: http_multi_server + url: "https://pub.dartlang.org" + source: hosted + version: "2.2.0" + http_parser: + dependency: transitive + description: + name: http_parser + url: "https://pub.dartlang.org" + source: hosted + version: "3.1.4" + io: + dependency: transitive + description: + name: io + url: "https://pub.dartlang.org" + source: hosted + version: "0.3.4" + js: + dependency: transitive + description: + name: js + url: "https://pub.dartlang.org" + source: hosted + version: "0.6.1+1" + logging: + dependency: transitive + description: + name: logging + url: "https://pub.dartlang.org" + source: hosted + version: "0.11.4" matcher: - description: matcher + dependency: transitive + description: + name: matcher + url: "https://pub.dartlang.org" + source: hosted + version: "0.12.6" + meta: + dependency: transitive + description: + name: meta + url: "https://pub.dartlang.org" + source: hosted + version: "1.1.8" + mime: + dependency: transitive + description: + name: mime + url: "https://pub.dartlang.org" + source: hosted + version: "0.9.6+3" + multi_server_socket: + dependency: transitive + description: + name: multi_server_socket + url: "https://pub.dartlang.org" + source: hosted + version: "1.0.2" + node_interop: + dependency: transitive + description: + name: node_interop + url: "https://pub.dartlang.org" + source: hosted + version: "1.0.3" + node_io: + dependency: transitive + description: + name: node_io + url: "https://pub.dartlang.org" source: hosted - version: "0.11.1" + version: "1.0.1+2" + node_preamble: + dependency: transitive + description: + name: node_preamble + url: "https://pub.dartlang.org" + source: hosted + version: "1.4.8" + package_config: + dependency: transitive + description: + name: package_config + url: "https://pub.dartlang.org" + source: hosted + version: "1.9.3" path: - description: path + dependency: "direct main" + description: + name: path + url: "https://pub.dartlang.org" + source: hosted + version: "1.7.0" + pedantic: + dependency: transitive + description: + name: pedantic + url: "https://pub.dartlang.org" + source: hosted + version: "1.9.0" + pool: + dependency: transitive + description: + name: pool + url: "https://pub.dartlang.org" + source: hosted + version: "1.4.0" + pub_semver: + dependency: transitive + description: + name: pub_semver + url: "https://pub.dartlang.org" + source: hosted + version: "1.4.4" + shelf: + dependency: transitive + description: + name: shelf + url: "https://pub.dartlang.org" + source: hosted + version: "0.7.5" + shelf_packages_handler: + dependency: transitive + description: + name: shelf_packages_handler + url: "https://pub.dartlang.org" + source: hosted + version: "2.0.0" + shelf_static: + dependency: transitive + description: + name: shelf_static + url: "https://pub.dartlang.org" + source: hosted + version: "0.2.8" + shelf_web_socket: + dependency: transitive + description: + name: shelf_web_socket + url: "https://pub.dartlang.org" + source: hosted + version: "0.2.3" + source_map_stack_trace: + dependency: transitive + description: + name: source_map_stack_trace + url: "https://pub.dartlang.org" + source: hosted + version: "2.0.0" + source_maps: + dependency: transitive + description: + name: source_maps + url: "https://pub.dartlang.org" + source: hosted + version: "0.10.9" + source_span: + dependency: transitive + description: + name: source_span + url: "https://pub.dartlang.org" source: hosted - version: "1.3.0" + version: "1.7.0" stack_trace: - description: stack_trace + dependency: transitive + description: + name: stack_trace + url: "https://pub.dartlang.org" source: hosted - version: "1.0.2" - unittest: - description: unittest + version: "1.9.3" + stream_channel: + dependency: transitive + description: + name: stream_channel + url: "https://pub.dartlang.org" + source: hosted + version: "2.0.0" + string_scanner: + dependency: transitive + description: + name: string_scanner + url: "https://pub.dartlang.org" + source: hosted + version: "1.0.5" + term_glyph: + dependency: transitive + description: + name: term_glyph + url: "https://pub.dartlang.org" + source: hosted + version: "1.1.0" + test: + dependency: "direct main" + description: + name: test + url: "https://pub.dartlang.org" + source: hosted + version: "1.14.2" + test_api: + dependency: transitive + description: + name: test_api + url: "https://pub.dartlang.org" + source: hosted + version: "0.2.15" + test_core: + dependency: transitive + description: + name: test_core + url: "https://pub.dartlang.org" + source: hosted + version: "0.3.3" + typed_data: + dependency: transitive + description: + name: typed_data + url: "https://pub.dartlang.org" + source: hosted + version: "1.1.6" + vm_service: + dependency: transitive + description: + name: vm_service + url: "https://pub.dartlang.org" + source: hosted + version: "4.0.2" + watcher: + dependency: transitive + description: + name: watcher + url: "https://pub.dartlang.org" + source: hosted + version: "0.9.7+15" + web_socket_channel: + dependency: transitive + description: + name: web_socket_channel + url: "https://pub.dartlang.org" + source: hosted + version: "1.1.0" + webkit_inspection_protocol: + dependency: transitive + description: + name: webkit_inspection_protocol + url: "https://pub.dartlang.org" + source: hosted + version: "0.5.0+1" + yaml: + dependency: transitive + description: + name: yaml + url: "https://pub.dartlang.org" source: hosted - version: "0.11.0+4" + version: "2.2.1" +sdks: + dart: ">=2.7.0 <3.0.0" diff --git a/pubspec.yaml b/pubspec.yaml index b8c3d40..097250e 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,10 +1,10 @@ -name: dart_koans +name: dart2_koans version: 0.0.2+2 author: Matthew Butler description: An application designed to help teach basics of the Dart language and core libraries through Unittests. It is highly recommended that this package is downloaded manually or cloning the github repository. *Do not* install with pub. homepage: https://github.com/butlermatt/dart_koans environment: - sdk: '>=1.3.0 <1.7.0' + sdk: '^2.3.0' dependencies: - path: '>=1.0.0 <2.0.0' - unittest: '>=0.10.0 <0.12.0' + path: '^1.7.0' + test: '^1.14.2' diff --git a/lib/boolean.dart b/test/boolean_test.dart similarity index 88% rename from lib/boolean.dart rename to test/boolean_test.dart index 5e13378..f69c623 100644 --- a/lib/boolean.dart +++ b/test/boolean_test.dart @@ -1,6 +1,8 @@ -part of dart_koans; +import "package:test/test.dart"; -void using_boolean() { +const _____ = ""; + +void main() { group('Boolean -', () { group('Declaring -', () { test('bool', () { @@ -17,7 +19,7 @@ void using_boolean() { * infer the type for us. */ var boolean = _____; - expect(boolean, isBool); + expect(boolean, isA()); }); }); group('Values -', () { @@ -35,7 +37,7 @@ void using_boolean() { * for details: http://goo.gl/gBUIZ ) */ var boolean = 0; - expect(_____, isNotBool); + expect(_____, isNot(isA())); }); test('1 not true', () { /* @@ -44,7 +46,7 @@ void using_boolean() { * also not the case in Dart. */ var boolean = 1; - expect(_____, isNotBool); + expect(_____, isNot(isA())); }); test('negated', () { /* diff --git a/lib/lists.dart b/test/lists_test.dart similarity index 95% rename from lib/lists.dart rename to test/lists_test.dart index 57a624b..63af9c9 100644 --- a/lib/lists.dart +++ b/test/lists_test.dart @@ -1,6 +1,8 @@ -part of dart_koans; +import "package:test/test.dart"; -void using_lists() { +const _____ = ""; + +void main() { group('Lists -', () { group('Declaring -', () { test('literal', () { @@ -20,7 +22,7 @@ void using_lists() { * can contain multiple different types. */ var list = [3, 2, 4.5, 0.03, 'string', ['sublist', true], false]; - expect(_____, isList); + expect(_____, isA()); }); test('Constructor', () { /* @@ -30,7 +32,7 @@ void using_lists() { * list. */ var list = new List(); - expect(_____, isList); + expect(_____, isA()); }); test('Using Generics', () { /* @@ -42,7 +44,7 @@ void using_lists() { * or errors when unexpected types appear. */ var list = new List(); - expect(_____, isList); + expect(_____, isA()); }); test('Fixed-Size', () { /* @@ -54,7 +56,7 @@ void using_lists() { * list using Generics. */ var list = new List(10); - expect(_____, isList); + expect(_____, isA()); }); }); group('Accessing -', () { @@ -166,7 +168,9 @@ void using_lists() { * element to a list. So what do you suppose happens * if you try adding another list to a list. */ - var list = [0, 1, 2]; + + // This must be declared explicitly in Dart2. + var list = [0, 1, [2]]; list.add([3, 4]); expect(list, equals([_____])); }); diff --git a/lib/numbers.dart b/test/numbers_test.dart similarity index 84% rename from lib/numbers.dart rename to test/numbers_test.dart index ae35943..86b8b0f 100644 --- a/lib/numbers.dart +++ b/test/numbers_test.dart @@ -1,6 +1,8 @@ -part of dart_koans; +import "package:test/test.dart"; -start_here() { +const _____ = ""; + +void main() { group('Introduction -', () { test('First steps', () { /* @@ -30,14 +32,14 @@ start_here() { * The num type holds numbers including whole numbers. */ num number = 5; - expect(_____, isNum); + expect(_____, isA()); }); test('num - decimal numbers', () { /* * The num type can also hold decimal numbers */ num number = 5.3; - expect(_____, isNum); + expect(_____, isA()); }); test('var', () { /* @@ -46,7 +48,7 @@ start_here() { * for variable) or as a specific type. */ var number = 5; - expect(_____, isNum); + expect(_____, isA()); }); group('Integers -', () { test('int', () { @@ -56,7 +58,7 @@ start_here() { * whole numbers. */ int number = 5; - expect(_____, isInt); + expect(_____, isA()); }); test('num', () { /* @@ -65,7 +67,7 @@ start_here() { * int is a num. */ int number = 5; - expect(_____, isNum); + expect(_____, isA()); }); test('var', () { /* @@ -73,14 +75,14 @@ start_here() { * were not declared. */ var number = 5; - expect(_____, isInt); + expect(_____, isA()); }); test('not decimal', () { /* * Note that decimal numbers are not Integers (int) */ var number = 5.3; - expect(_____, isNotInt); + expect(_____, isNot(isA())); }); test('arbitrary size', () { /* @@ -88,8 +90,8 @@ start_here() { * are of an arbitrary size. Unlike in many other languages * where they have a maximum upper limit. */ - var number = 100085866835557563992823856846813251884354791321628; - expect(_____, isInt); + var number = BigInt.parse("100085866835557563992823856846813251884354791321628"); + expect(_____, isA()); }); }); group('Decimals -', () { @@ -100,14 +102,14 @@ start_here() { * point number. */ double number = 5.3; - expect(_____, isDouble); + expect(_____, isA()); }); test('num', () { /* * Just like integers, doubles are a subclass of num. */ double number = 5.3; - expect(_____, isNum); + expect(_____, isA()); }); test('var', () { /* @@ -115,14 +117,14 @@ start_here() { * is actually holding a double. */ var number = 5.3; - expect(_____, isDouble); + expect(_____, isA()); }); test('not integer', () { /* * And remember that integers are not doubles. */ var number = 5; - expect(_____, isNotDouble); + expect(_____, isNot(isA())); }); test('supports exponents', () { /* @@ -130,8 +132,8 @@ start_here() { * Integers do not. */ var number = 1.423e12; - expect(_____, isDouble); - expect(_____, isNotInt); + expect(_____, isA()); + expect(_____, isNot(isA())); }); }); test('which type', () { diff --git a/lib/objects.dart b/test/objects_test.dart similarity index 87% rename from lib/objects.dart rename to test/objects_test.dart index 0c42289..42b06b4 100644 --- a/lib/objects.dart +++ b/test/objects_test.dart @@ -1,6 +1,8 @@ -part of dart_koans; +import "package:test/test.dart"; -void using_objects() { +const _____ = ""; + +void main() { group('Objects -', () { group('Everything -', () { test('Introduction', () { @@ -9,7 +11,7 @@ void using_objects() { * but everything in Dart is an object. */ var number = 5; - expect(_____, isObject); + expect(_____, isA()); }); test('Simple Types', () { /* @@ -17,12 +19,12 @@ void using_objects() { * are objects as well. */ bool boolean = true; - expect(_____, isObject); + expect(_____, isA()); }); test('Even literals', () { /* * Even literals are objects in Dart. Check if - * 5 isNum and if it isObject. + * 5 isNum and if it isA(). * * Note that the isXxxx notation is the the correct * way of checking a type. We'll look at that later @@ -62,8 +64,11 @@ void using_objects() { * can catch errors, as well some special things we * can do with NoSuchMethod. */ + var boolean = true; - var broken = () => boolean.causeError(); + var broken; + // Uncomment line below! + // broken = () => boolean.causeError(); expect(_____, throwsNoSuchMethodError); }); }); diff --git a/lib/strings.dart b/test/strings_test.dart similarity index 95% rename from lib/strings.dart rename to test/strings_test.dart index 889f14a..d8e9b05 100644 --- a/lib/strings.dart +++ b/test/strings_test.dart @@ -1,6 +1,8 @@ -part of dart_koans; +import "package:test/test.dart"; -void using_strings() { +const _____ = ""; + +void main() { group('Strings -', () { group('Declaring -', () { test('single quotes', () { @@ -105,8 +107,12 @@ _____ * now just concentrate on the fact that a string and * non-string added together throws an error. */ - var broken = () => 'two ' + 3; - expect(_____, throwsArgumentError); + + + var broken; + // Uncomment line below! + // broken = () => 'two ' + 3; + expect(broken, throwsArgumentError); }); }); group('Interpolation -', () { @@ -178,7 +184,10 @@ _____ // We'll cover that in more detail later. For now only be // concerned that anything after the => below causes the // error to be thrown. - var broken = () => str[0] = 'h'; + + var broken; + // Uncomment line below! + // broken = () => str[0] = 'h'; expect(_____, throwsNoSuchMethodError); }); });