Skip to content

Commit

Permalink
Move tests using arrow fns from TypeCheckTest to TypeCheckNoTranspile…
Browse files Browse the repository at this point in the history
…Test.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=214048042
  • Loading branch information
lauraharker authored and tjgq committed Sep 22, 2018
1 parent e8315c6 commit fe6b19c
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 38 deletions.
36 changes: 36 additions & 0 deletions test/com/google/javascript/jscomp/TypeCheckNoTranspileTest.java
Expand Up @@ -219,6 +219,42 @@ public void testAsyncArrowWithIncorrectBlocklessReturn() {
"required: string"));
}

@Test
public void testTypedefOfPropertyInBlock() {
disableStrictMissingPropertyChecks();
testTypesWithExterns(
"/** @interface */ function Foo() {}",
lines(
"/** @constructor */",
"function Bar(/** !Foo */ foo) {",
" /** @type {!Foo} */",
" this.foo = foo;",
" {",
" /** @typedef {boolean} */",
" this.foo.bar;",
" (() => this.foo.bar)();",
" }",
"}"));
}

@Test
public void testTypedefOfPropertyInFunctionScope() {
disableStrictMissingPropertyChecks();
testTypesWithExterns(
"/** @interface */ function Foo() {}",
lines(
"/** @constructor */",
"function Bar(/** !Foo */ foo) {",
" /** @type {!Foo} */",
" this.foo = foo;",
" /** @typedef {boolean} */",
" this.foo.bar;",
" {",
" (() => this.foo.bar)();",
" }",
"}"));
}

@Test
public void testArrayLitSpread() {
// TODO(bradfordcsmith): check spread in array literal
Expand Down
38 changes: 0 additions & 38 deletions test/com/google/javascript/jscomp/TypeCheckTest.java
Expand Up @@ -22514,44 +22514,6 @@ public void testNestedFunctionTemplatesMismatch() {
// "required: Foo<T, S>"));
}

@Test
public void testTypedefOfPropertyInBlock() {
// TODO(b/111216910): this should issue the same warning as the case below
disableStrictMissingPropertyChecks();
testTypesWithExterns(
"/** @interface */ function Foo() {}",
lines(
"/** @constructor */",
"function Bar(/** !Foo */ foo) {",
" /** @type {!Foo} */",
" this.foo = foo;",
" {",
" /** @typedef {boolean} */",
" this.foo.bar;",
" (() => this.foo.bar)();",
" }",
"}"));
}

@Test
public void testTypedefOfPropertyInFunctionScope() {
disableStrictMissingPropertyChecks();
testTypesWithExterns(
"/** @interface */ function Foo() {}",
lines(
"/** @constructor */",
"function Bar(/** !Foo */ foo) {",
" /** @type {!Foo} */",
" this.foo = foo;",
" /** @typedef {boolean} */",
" this.foo.bar;",
" {",
" (() => this.foo.bar)();",
" }",
"}"),
"Property bar never defined on Foo");
}

@Test
public void testTypeCheckingDoesntCrashOnDebuggerStatement() {
testTypes("var x = 1; debugger; x = 2;");
Expand Down

0 comments on commit fe6b19c

Please sign in to comment.