Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(19)

Issue 2824393002: Introduce a testing framework for use with fasta type inference. (Closed)

Created:
3 years, 8 months ago by Paul Berry
Modified:
3 years, 8 months ago
Reviewers:
ahe
CC:
reviews_dartlang.org, dart-fe-team+reviews_google.com
Target Ref:
refs/heads/master
Visibility:
Public.

Description

Introduce a testing framework for use with fasta type inference. The framework will allow test source files to be annotated with comments indicating where types are expected to be inferred, for example: var /*@type=dart.core::int*/ x = 1; Other features of the testing framework: - Normally only those expectations explicitly listed will be checked. The special comment "/*@testedFeatures=inference*/" at the top of the file turns on extra checking which will cause the test to fail if any unexpected type inference occurs. - Should be easy to extend to support other features, such as checking that the proper errors and warnings are generated at the proper locations. - If the test is run with "-DupdateExpectations=true", the expectations will be updated in place. R=ahe@google.com Committed: https://github.com/dart-lang/sdk/commit/a682c6a97ea14dbef3f196973271dab0a678c0ca

Patch Set 1 #

Total comments: 25
Unified diffs Side-by-side diffs Delta from patch set Stats (+319 lines, -6 lines) Patch
A pkg/front_end/lib/src/base/instrumentation.dart View 1 chunk +58 lines, -0 lines 2 comments Download
M pkg/front_end/lib/src/fasta/kernel/kernel_shadow_ast.dart View 2 chunks +4 lines, -2 lines 0 comments Download
M pkg/front_end/lib/src/fasta/source/source_loader.dart View 3 chunks +5 lines, -1 line 0 comments Download
M pkg/front_end/lib/src/fasta/testing/suite.dart View 3 chunks +18 lines, -1 line 0 comments Download
A pkg/front_end/lib/src/fasta/testing/validating_instrumentation.dart View 1 chunk +224 lines, -0 lines 23 comments Download
M pkg/front_end/lib/src/fasta/type_inference/type_inferrer.dart View 2 chunks +4 lines, -1 line 0 comments Download
M pkg/front_end/test/subpackage_relationships_test.dart View 3 chunks +6 lines, -1 line 0 comments Download

Messages

Total messages: 9 (2 generated)
Paul Berry
3 years, 8 months ago (2017-04-19 09:33:38 UTC) #2
ahe
lgtm Only nits below. https://codereview.chromium.org/2824393002/diff/1/pkg/front_end/lib/src/base/instrumentation.dart File pkg/front_end/lib/src/base/instrumentation.dart (right): https://codereview.chromium.org/2824393002/diff/1/pkg/front_end/lib/src/base/instrumentation.dart#newcode23 pkg/front_end/lib/src/base/instrumentation.dart:23: String canonicalize(); Is this a ...
3 years, 8 months ago (2017-04-19 11:38:30 UTC) #3
ahe
FYI https://codereview.chromium.org/2824393002/diff/1/pkg/front_end/lib/src/fasta/testing/validating_instrumentation.dart File pkg/front_end/lib/src/fasta/testing/validating_instrumentation.dart (right): https://codereview.chromium.org/2824393002/diff/1/pkg/front_end/lib/src/fasta/testing/validating_instrumentation.dart#newcode77 pkg/front_end/lib/src/fasta/testing/validating_instrumentation.dart:77: // Remove the trailing \0 that's added by ...
3 years, 8 months ago (2017-04-19 13:11:00 UTC) #4
Paul Berry
https://codereview.chromium.org/2824393002/diff/1/pkg/front_end/lib/src/base/instrumentation.dart File pkg/front_end/lib/src/base/instrumentation.dart (right): https://codereview.chromium.org/2824393002/diff/1/pkg/front_end/lib/src/base/instrumentation.dart#newcode23 pkg/front_end/lib/src/base/instrumentation.dart:23: String canonicalize(); On 2017/04/19 11:38:29, ahe wrote: > Is ...
3 years, 8 months ago (2017-04-19 13:20:10 UTC) #5
Paul Berry
https://codereview.chromium.org/2824393002/diff/1/pkg/front_end/lib/src/fasta/testing/validating_instrumentation.dart File pkg/front_end/lib/src/fasta/testing/validating_instrumentation.dart (right): https://codereview.chromium.org/2824393002/diff/1/pkg/front_end/lib/src/fasta/testing/validating_instrumentation.dart#newcode77 pkg/front_end/lib/src/fasta/testing/validating_instrumentation.dart:77: // Remove the trailing \0 that's added by readBytesFromFile. ...
3 years, 8 months ago (2017-04-19 13:53:55 UTC) #6
Paul Berry
Committed patchset #1 (id:1) manually as a682c6a97ea14dbef3f196973271dab0a678c0ca (presubmit successful).
3 years, 8 months ago (2017-04-19 13:54:17 UTC) #8
Paul Berry
3 years, 8 months ago (2017-04-19 15:31:21 UTC) #9
Message was sent while issue was closed.
https://codereview.chromium.org/2824393002/diff/1/pkg/front_end/lib/src/fasta...
File pkg/front_end/lib/src/fasta/testing/validating_instrumentation.dart
(right):

https://codereview.chromium.org/2824393002/diff/1/pkg/front_end/lib/src/fasta...
pkg/front_end/lib/src/fasta/testing/validating_instrumentation.dart:98:
commentToken = commentToken.next) {
On 2017/04/19 13:20:10, Paul Berry wrote:
> On 2017/04/19 11:38:29, ahe wrote:
> > Perhaps we should add a forEachComment to ScannerResult?
> 
> Fair enough.  I will do that as a follow-up CL.

I looked into this and it's uglier than I expected, because we actually need to
know both the comment token and the non-comment token it's attached to.  Which
means the signature of ScannerResult.forEachComment would have to be something
like:

void forEachComment(void callback(Token commentToken, Token anchorToken));

IMHO it's not worth it so I'm going to leave it as is.

Powered by Google App Engine
This is Rietveld 408576698