Skip to content
Browse files

info about importing libraries

  • Loading branch information...
1 parent d112d0c commit 9348ddcea5c9965452e547f0c9a8d165c0dc3edd Sam McCall committed
Showing with 18 additions and 0 deletions.
  1. +11 −0 README.md
  2. +7 −0 test/test_sandbox.dart
View
11 README.md
@@ -37,6 +37,17 @@ environment variables DART_SOURCES and DART_SDK.
# Limitations and workarounds
+## You can't import libraries
+
+ >> #import('mylib.dart');
+ Exception: 'console_declaration_3': Error: line 3 pos 1: unexpected token '#import'
+
+Workaround: `dart:io` is already loaded under the prefix `io`.
+
+Workaround: edit lib/sandbox.dart and add your imports to `_BASE`
+
+This is easy to fix, I just haven't done it yet...
+
## You can't "overwrite" a declared name.
>> foo() => 1;
View
7 test/test_sandbox.dart
@@ -88,4 +88,11 @@ get TESTS() => {
sandbox.execute('foo();');
Expect.equals(42, sandbox.eval('bar()'));
}),
+
+ 'importFails': test((sandbox) { // Documented issue
+ Expect.throws(() => sandbox.import('bar.dart'));
+ }),
+ 'ioAvailable': test((sandbox) { // Documented workaround
+ Expect.isNotNull(sandbox.eval('io.stdout'));
+ }),
};

0 comments on commit 9348ddc

Please sign in to comment.
Something went wrong with that request. Please try again.