Add tests and baselines

This commit is contained in:
Kate Miháliková 2017-05-29 13:41:28 +02:00
parent e3e81b8673
commit 2d60b2d117
No known key found for this signature in database
GPG Key ID: 1514D3C02EC152B0
10 changed files with 236 additions and 0 deletions

View File

@ -424,6 +424,50 @@ class D { }\r\n\
comment("=======\r\nclass D { }\r\n"),
comment(">>>>>>> Branch - a"),
finalEndOfLineState(ts.EndOfLineState.None));
testLexicalClassification(
"class C {\r\n\
<<<<<<< HEAD\r\n\
v = 1;\r\n\
||||||| merged common ancestors\r\n\
v = 3;\r\n\
=======\r\n\
v = 2;\r\n\
>>>>>>> Branch - a\r\n\
}",
ts.EndOfLineState.None,
keyword("class"),
identifier("C"),
punctuation("{"),
comment("<<<<<<< HEAD"),
identifier("v"),
operator("="),
numberLiteral("1"),
punctuation(";"),
comment("||||||| merged common ancestors\r\n v = 3;\r\n"),
comment("=======\r\n v = 2;\r\n"),
comment(">>>>>>> Branch - a"),
punctuation("}"),
finalEndOfLineState(ts.EndOfLineState.None));
testLexicalClassification(
"<<<<<<< HEAD\r\n\
class C { }\r\n\
||||||| merged common ancestors\r\n\
class E { }\r\n\
=======\r\n\
class D { }\r\n\
>>>>>>> Branch - a\r\n",
ts.EndOfLineState.None,
comment("<<<<<<< HEAD"),
keyword("class"),
identifier("C"),
punctuation("{"),
punctuation("}"),
comment("||||||| merged common ancestors\r\nclass E { }\r\n"),
comment("=======\r\nclass D { }\r\n"),
comment(">>>>>>> Branch - a"),
finalEndOfLineState(ts.EndOfLineState.None));
});
it("'of' keyword", function () {

View File

@ -0,0 +1,24 @@
tests/cases/compiler/conflictMarkerDiff3Trivia1.ts(2,1): error TS1185: Merge conflict marker encountered.
tests/cases/compiler/conflictMarkerDiff3Trivia1.ts(4,1): error TS1185: Merge conflict marker encountered.
tests/cases/compiler/conflictMarkerDiff3Trivia1.ts(6,1): error TS1185: Merge conflict marker encountered.
tests/cases/compiler/conflictMarkerDiff3Trivia1.ts(8,1): error TS1185: Merge conflict marker encountered.
==== tests/cases/compiler/conflictMarkerDiff3Trivia1.ts (4 errors) ====
class C {
<<<<<<< HEAD
~~~~~~~
!!! error TS1185: Merge conflict marker encountered.
v = 1;
||||||| merged common ancestors
~~~~~~~
!!! error TS1185: Merge conflict marker encountered.
v = 3;
=======
~~~~~~~
!!! error TS1185: Merge conflict marker encountered.
v = 2;
>>>>>>> Branch-a
~~~~~~~
!!! error TS1185: Merge conflict marker encountered.
}

View File

@ -0,0 +1,18 @@
//// [conflictMarkerDiff3Trivia1.ts]
class C {
<<<<<<< HEAD
v = 1;
||||||| merged common ancestors
v = 3;
=======
v = 2;
>>>>>>> Branch-a
}
//// [conflictMarkerDiff3Trivia1.js]
var C = (function () {
function C() {
this.v = 1;
}
return C;
}());

View File

@ -0,0 +1,34 @@
tests/cases/compiler/conflictMarkerDiff3Trivia2.ts(3,1): error TS1185: Merge conflict marker encountered.
tests/cases/compiler/conflictMarkerDiff3Trivia2.ts(4,6): error TS2304: Cannot find name 'a'.
tests/cases/compiler/conflictMarkerDiff3Trivia2.ts(6,1): error TS1185: Merge conflict marker encountered.
tests/cases/compiler/conflictMarkerDiff3Trivia2.ts(9,1): error TS1185: Merge conflict marker encountered.
tests/cases/compiler/conflictMarkerDiff3Trivia2.ts(12,1): error TS1185: Merge conflict marker encountered.
==== tests/cases/compiler/conflictMarkerDiff3Trivia2.ts (5 errors) ====
class C {
foo() {
<<<<<<< B
~~~~~~~
!!! error TS1185: Merge conflict marker encountered.
a();
~
!!! error TS2304: Cannot find name 'a'.
}
||||||| merged common ancestors
~~~~~~~
!!! error TS1185: Merge conflict marker encountered.
c();
}
=======
~~~~~~~
!!! error TS1185: Merge conflict marker encountered.
b();
}
>>>>>>> A
~~~~~~~
!!! error TS1185: Merge conflict marker encountered.
public bar() { }
}

View File

@ -0,0 +1,28 @@
//// [conflictMarkerDiff3Trivia2.ts]
class C {
foo() {
<<<<<<< B
a();
}
||||||| merged common ancestors
c();
}
=======
b();
}
>>>>>>> A
public bar() { }
}
//// [conflictMarkerDiff3Trivia2.js]
var C = (function () {
function C() {
}
C.prototype.foo = function () {
a();
};
C.prototype.bar = function () { };
return C;
}());

View File

@ -0,0 +1,9 @@
class C {
<<<<<<< HEAD
v = 1;
||||||| merged common ancestors
v = 3;
=======
v = 2;
>>>>>>> Branch-a
}

View File

@ -0,0 +1,15 @@
class C {
foo() {
<<<<<<< B
a();
}
||||||| merged common ancestors
c();
}
=======
b();
}
>>>>>>> A
public bar() { }
}

View File

@ -0,0 +1,22 @@
/// <reference path='fourslash.ts' />
////class C {
////<<<<<<< HEAD
////v = 1;
////||||||| merged common ancestors
////v = 3;
////=======
////v = 2;
////>>>>>>> Branch - a
////}
format.document();
verify.currentFileContentIs("class C {\r\n\
<<<<<<< HEAD\r\n\
v = 1;\r\n\
||||||| merged common ancestors\r\n\
v = 3;\r\n\
=======\r\n\
v = 2;\r\n\
>>>>>>> Branch - a\r\n\
}");

View File

@ -0,0 +1,23 @@
/// <reference path="fourslash.ts"/>
////class C {
////<<<<<<< HEAD
//// v = 1;
////||||||| merged common ancestors
//// v = 3;
////=======
//// v = 2;
////>>>>>>> Branch - a
////}
const c = classification;
verify.syntacticClassificationsAre(
c.keyword("class"), c.className("C"), c.punctuation("{"),
c.comment("<<<<<<< HEAD"),
c.identifier("v"), c.operator("="), c.numericLiteral("1"), c.punctuation(";"),
c.comment("||||||| merged common ancestors"),
c.identifier("v"), c.punctuation("="), c.numericLiteral("3"), c.punctuation(";"),
c.comment("======="),
c.identifier("v"), c.punctuation("="), c.numericLiteral("2"), c.punctuation(";"),
c.comment(">>>>>>> Branch - a"),
c.punctuation("}"));

View File

@ -0,0 +1,19 @@
/// <reference path="fourslash.ts"/>
////<<<<<<< HEAD
////class C { }
////||||||| merged common ancestors
////class E { }
////=======
////class D { }
////>>>>>>> Branch - a
const c = classification;
verify.syntacticClassificationsAre(
c.comment("<<<<<<< HEAD"),
c.keyword("class"), c.className("C"), c.punctuation("{"), c.punctuation("}"),
c.comment("||||||| merged common ancestors"),
c.keyword("class"), c.identifier("E"), c.punctuation("{"), c.punctuation("}"),
c.comment("======="),
c.keyword("class"), c.identifier("D"), c.punctuation("{"), c.punctuation("}"),
c.comment(">>>>>>> Branch - a"));