mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-02-26 12:43:48 -06:00
Add tests and baselines
This commit is contained in:
parent
e3e81b8673
commit
2d60b2d117
@ -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 () {
|
||||
|
||||
@ -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.
|
||||
}
|
||||
18
tests/baselines/reference/conflictMarkerDiff3Trivia1.js
Normal file
18
tests/baselines/reference/conflictMarkerDiff3Trivia1.js
Normal 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;
|
||||
}());
|
||||
@ -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() { }
|
||||
}
|
||||
|
||||
28
tests/baselines/reference/conflictMarkerDiff3Trivia2.js
Normal file
28
tests/baselines/reference/conflictMarkerDiff3Trivia2.js
Normal 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;
|
||||
}());
|
||||
9
tests/cases/compiler/conflictMarkerDiff3Trivia1.ts
Normal file
9
tests/cases/compiler/conflictMarkerDiff3Trivia1.ts
Normal file
@ -0,0 +1,9 @@
|
||||
class C {
|
||||
<<<<<<< HEAD
|
||||
v = 1;
|
||||
||||||| merged common ancestors
|
||||
v = 3;
|
||||
=======
|
||||
v = 2;
|
||||
>>>>>>> Branch-a
|
||||
}
|
||||
15
tests/cases/compiler/conflictMarkerDiff3Trivia2.ts
Normal file
15
tests/cases/compiler/conflictMarkerDiff3Trivia2.ts
Normal file
@ -0,0 +1,15 @@
|
||||
class C {
|
||||
foo() {
|
||||
<<<<<<< B
|
||||
a();
|
||||
}
|
||||
||||||| merged common ancestors
|
||||
c();
|
||||
}
|
||||
=======
|
||||
b();
|
||||
}
|
||||
>>>>>>> A
|
||||
|
||||
public bar() { }
|
||||
}
|
||||
22
tests/cases/fourslash/formatConflictDiff3Marker1.ts
Normal file
22
tests/cases/fourslash/formatConflictDiff3Marker1.ts
Normal 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\
|
||||
}");
|
||||
@ -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("}"));
|
||||
@ -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"));
|
||||
Loading…
x
Reference in New Issue
Block a user