Skip to content

Commit

Permalink
Minor improvments of tests for microsoft#6579
Browse files Browse the repository at this point in the history
  • Loading branch information
Igmat committed Nov 21, 2016
1 parent 70ccfdf commit 32c5af4
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 3 deletions.
8 changes: 7 additions & 1 deletion tests/cases/compiler/regexValidatedTypeAssignment.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ email = 'test@example.com';
email = 'test@gmail.com';
gmail = 'test@example.com';
gmail = 'test@gmail.com';

gmail = email;
email = gmail;

gmail = <Gmail>email;
if (Gmail.test(email)) {
gmail = email;
Expand All @@ -18,17 +18,23 @@ if (Gmail.test(email)) {
let someEmail = 'test@example.com';
let someGmail = 'test@gmail.com';
email = someEmail;
email = someGmail;
gmail = someEmail;
gmail = someGmail;
email = <Email>someEmail;
gmail = <Gmail>someGmail;
if (Email.test(someEmail)) {
email = someEmail;
gmail = someEmail;
}
if (Gmail.test(someGmail)) {
email = someGmail;
gmail = someGmail;
}

let someEmailLiteral: 'test@example.com' = 'test@example.com';
let someGmailLiteral: 'test@gmail.com' = 'test@gmail.com';
email = someEmailLiteral;
email = someGmailLiteral;
gmail = someEmailLiteral;
gmail = someGmailLiteral;
18 changes: 16 additions & 2 deletions tests/cases/compiler/regexValidatedTypeIndex.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,5 +31,19 @@ collection[<Email>someEmail].usersProperty;
collection[<Email>someEmail].gmailProperty;
collection[<Gmail>someGmail].usersProperty;
collection[<Gmail>someGmail].gmailProperty;
collection[<Email & Gmail> someGmail].usersProperty;
collection[<Email & Gmail> someGmail].gmailProperty;

if (Email.test(someEmail)) {
collection[someEmail].usersProperty;
collection[someEmail].gmailProperty;
}
if (Gmail.test(someGmail)) {
collection[someGmail].usersProperty;
collection[someGmail].gmailProperty;
}

let someEmailLiteral: 'test@example.com' = 'test@example.com';
let someGmailLiteral: 'test@gmail.com' = 'test@gmail.com';
collection[someEmailLiteral].usersProperty;
collection[someEmailLiteral].gmailProperty;
collection[someGmailLiteral].usersProperty;
collection[someGmailLiteral].gmailProperty;

0 comments on commit 32c5af4

Please sign in to comment.