Dart-editor bug when importing unittest package #6517

Closed
DartBot opened this Issue Nov 4, 2012 · 12 comments

Comments

Projects
None yet
5 participants
Member

DartBot commented Nov 4, 2012

This issue was originally filed by shaile...@google.com


What steps will reproduce the problem?

  1. Start a new non-web application. Make sure "Add Pub Support" is checked.
  2. Uncomment the following in pubspec.yaml:
    dependencies:
      unittest: { sdk: unittest }

and run "pub install"

  1. Add the following code to <projectname>.dart:

import "package:unittest/unittest.dart";

num add(num x, num y) {
 return x + y;
}

void main() {
 test('add()', () =>
     expect(add(3, 4), 7)
 );
}

and now run the tests.

What is the expected output? What do you see instead?

I expect the test to pass and for the editor not to contain any warnings.

The test does indeed pass.

However, the editor complains that "Cannot find referenced source: package:unittest/unittest.dart." It also complains that it cannot resolve the test() and expect() methods.

If I close and then reopen the <projectname>.dart file, all warnings disappear.

What version of the product are you using? On what operating system?

Dart Editor version 0.2.1_r14167
Dart SDK version 0.2.1.2_r14167
OS X 10.8.2

Please provide any additional information below.

Member

lrhn commented Nov 4, 2012

Added Area-Editor, Triaged labels.

clayberg commented Nov 8, 2012

Set owner to @keertip.
Added this to the M3 milestone.

Contributor

keertip commented Nov 8, 2012

Konstantin,

Could this be the case of the open editor not clearing the markers on reconcile? Because if the file is closed and re-opened, the error markers are gone.


Set owner to @scheglov.

Contributor

keertip commented Nov 8, 2012

Issue #6536 has been merged into this issue.

Contributor

scheglov commented Nov 8, 2012

It seems that UrlLibrarySource has invalid packageLibraryManager.

So "package:unittest/unittest.dart" is resolved into /Users/scheglov/Source/Dart/eclipse/Eclipse.app/Contents/MacOS/unittest/unittest.dart

And once we close editor, model probably re-creates library and uses correct PackageLibraryManager instance. So, it starts resolving package correctly.


Set owner to @keertip.

Contributor

keertip commented Nov 14, 2012

Removed this from the M3 milestone.
Added this to the M2 milestone.
Added Started label.

Member

DartBot commented Nov 19, 2012

This comment was originally written by ivo.bal...@gmail.com


I have the same problem running on Windows 7 64bit:
Dart Editor version 0.2.3_r14669
Dart SDK version 0.2.3.0_r14669

However the testproject does not run, I get the error:
Unable to open file: E:/dart/programs/test_unittest_package/bin/packages/unittest/unittest.dart'file:///E:/dart/programs/test_unittest_package/bin/test_unittest_package.dart': Error: line 1 pos 1: library handler failed
import "package:unittest/unittest.dart";
^

The same error when I leave Tools / Preferences / Package root directory empty or when I point it to E:\dart\programs\test_unittest_package\packages

Thanks,
^

Member

DartBot commented Nov 21, 2012

This comment was originally written by smdovia...@gmail.com


I am experiencing the same problem with any application that uses pub (sample applications, new applications and existing applications that were previously working now fail). There is no warning in the editor only at run time I get the error:
Unable to open file … library handler failed import

Dart Editor version 0.2.4_r15130
Dart SDK version 0.2.4.2_r15130
Win 7 64bit

Thanks,

Contributor

keertip commented Nov 21, 2012

Are you folks seeing this issue with just the unittest package or is it with all packages?

@ivo.balbaert, Could you make sure that bin/packages/unittest does point to an actual existing directory, the linking is all in order?

This might be a case of the links in the packages directory not pointing to the right files.

Member

DartBot commented Nov 21, 2012

This comment was originally written by ivo.balbaert...@gmail.com


Hi,

I installed Dart Editor 15042 (updating did not work, so I installed from scratch)
and the problem with test_unittest_package.dart is now solved (and it remains solved in 15130): unittest

Some earlier problems where also solved: it seems that in the past this was used:
import 'packages:unittest/unittest.dart';

 bin/packages/unittest does exist

where it now has to be import 'package:unittest/unittest.dart'; (s removed)

I verified that js and web_components could be installed:
  js: any
  unittest: { sdk: unittest }
  web_components: any

so I assume that all packages can be found.

Thanks guys!
Ivo

Member

DartBot commented Nov 21, 2012

This comment was originally written by smd...@gmail.com


I was able to resolve my issue by deleting all files in the <user's home directory>\DartEditor directory. Just to clarify I was having problems with all pub packages not just the unittest package.

Thanks

Contributor

keertip commented Nov 21, 2012

keertip was assigned by DartBot Nov 21, 2012

DartBot added this to the M2 milestone Nov 21, 2012

This issue was closed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment