Skip to content

Commit

Permalink
[Diff] Add some symbol tests
Browse files Browse the repository at this point in the history
Unfortunately, line ranges (which start at BOL) cannot be tested.
  • Loading branch information
michaelblyons committed Jan 9, 2025
1 parent 03488bb commit 3a03a92
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 2 deletions.
19 changes: 18 additions & 1 deletion Diff/tests/syntax_test_diff.diff
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
\ SYNTAX TEST "Packages/Diff/Diff.sublime-syntax"
\ SYNTAX TEST partial-symbols "Packages/Diff/Diff.sublime-syntax"

--- Path to Original File
\^^^^^^^^^^^^^^^^^^^^^^^^ meta.diff.header.from-file meta.header.from-file.diff - source.diff.git
Expand Down Expand Up @@ -103,6 +103,7 @@ Plain Text
\ ^^ markup.changed.diff meta.whitespace.trailing.diff

Index: lao
\ @@@ local-definition
\^^^^^^^^^^ meta.diff.index meta.index.diff
\^^^^ meta.mapping.key.diff keyword.other.diff
\ ^ punctuation.separator.key-value.diff
Expand Down Expand Up @@ -340,6 +341,7 @@ Diff3 Edit Format https://www.gnu.org/software/diffutils/manual/diffutils.html#S

SVN sample https://svnbook.red-bean.com/en/1.7/svn-book.html#idm10685
Index: deleted-file
\ @@@@@@@@@@@@ local-definition
\^^^^^^^^^^^^^^^^^^ meta.mapping.diff meta.diff.index meta.index.diff
\^^^^ meta.mapping.key.diff keyword.other.diff
\ ^ punctuation.separator.key-value.diff
Expand All @@ -364,6 +366,7 @@ Index: deleted-file
-This file will be deleted.
\^^^^^^^^^^^^^^^^^^^^^^^^^^ markup.deleted.diff
Index: changed-file
\ @@@@@@@@@@@@ local-definition
\^^^^^^^^^^^^^^^^^^ meta.mapping.diff meta.diff.index meta.index.diff
\^^^^ meta.mapping.key.diff keyword.other.diff
\ ^ punctuation.separator.key-value.diff
Expand All @@ -390,6 +393,7 @@ Property changes on: changed-file
___________________________________________________________________
\^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.separator.diff punctuation.separator.block.diff
Added: propname
\ @@@@@@@@ local-definition
\^^^^^^^^^^^^^^ meta.mapping.diff meta.diff.index meta.index.diff
\^^^^ meta.mapping.key.diff keyword.other.diff
\ ^ punctuation.separator.key-value.diff
Expand All @@ -398,6 +402,7 @@ Added: propname
+propvalue
\^^^^^^^^^ markup.inserted.diff
Index: added-file
\ @@@@@@@@@@ local-definition
===================================================================
--- added-file (revision 0)
+++ added-file (working copy)
Expand All @@ -407,6 +412,7 @@ Index: added-file

https://www.gnu.org/software/diffutils/manual/diffutils.html#Marking-Conflicts-1
<<<<<<< A
\ @ local-definition "Conflict: A"
\^^^^^^^^^ meta.block.conflict.begin.diff - meta.block meta.block - markup
\^^^^^^ punctuation.section.block.begin.diff
\ ^ - entity - punctuation
Expand All @@ -429,6 +435,7 @@ context context
\^^^^^^^^^^^^^^^ - meta.block

<<<<<<< A
\ @ local-definition "Conflict: A"
lines from A
||||||| B
\^^^^^^^^^ meta.block.conflict.separator.diff - meta.block meta.block - markup
Expand All @@ -453,12 +460,14 @@ context context
\ <- - meta.block

<<<<<<< tzu
\ @@@ local-definition "Conflict: tzu"
=======
The Way that can be told of is not the eternal Way;
The name that can be named is not the eternal name.
>>>>>>> tao

<<<<<<< lao
\ @@@ local-definition "Conflict: lao"
||||||| tzu
They both may be called deep and profound.
Deeper and more profound,
Expand All @@ -469,6 +478,7 @@ The door of all subtleties!
>>>>>>> tao

<<<<<<< lao
\ @@@ local-definition "Conflict: lao"
=======

-- The Way of Lao-Tzu, tr. Wing-tsit Chan
Expand All @@ -477,6 +487,7 @@ The door of all subtleties!

https://www.gnu.org/software/diffutils/manual/diffutils.html#Generating-the-Merged-Output-Directly
<<<<<<< tzu
\ @@@ local-definition "Conflict: tzu"
=======
The Way that can be told of is not the eternal Way;
The name that can be named is not the eternal name.
Expand All @@ -491,6 +502,7 @@ The two are the same,
But after they are produced,
they have different names.
<<<<<<< lao
\ @@@ local-definition "Conflict: lao"
||||||| tzu
They both may be called deep and profound.
Deeper and more profound,
Expand All @@ -502,6 +514,7 @@ The door of all subtleties!

If you have questions, please
<<<<<<< HEAD
\ @@@@ local-definition "Conflict: HEAD"
open an issue
=======
ask your question in IRC.
Expand All @@ -513,6 +526,7 @@ ask your question in IRC.

def hello
<<<<<<< ours
\ @@@@ local-definition "Conflict: ours"
puts 'hola world'
||||||| base
puts 'hello world'
Expand All @@ -526,6 +540,7 @@ hello()

\ https://git-scm.com/book/en/v2/Git-Branching-Basic-Branching-and-Merging#_basic_merge_conflicts
<<<<<<< HEAD:index.html
\ @@@@@@@@@@@@@@@ local-definition "Conflict: HEAD:index.html"
<div id="footer">contact : [email protected]</div>
=======
<div id="footer">
Expand All @@ -536,6 +551,7 @@ hello()

\ https://git-scm.com/docs/rerere.html#_nested_conflicts
<<<<<<< HEAD
\ @@@@ local-definition "Conflict: HEAD"
\^^^^^^^^^^^^ meta.block.conflict.begin.diff
\^^^^^^ punctuation.section.block.begin.diff
\ ^^^^ entity.name.section.diff
Expand All @@ -545,6 +561,7 @@ hello()
\^^^^^^^ meta.block.conflict.separator.diff
\^^^^^^ punctuation.section.block.diff
<<<<<<< HEAD
\ @@@@ local-definition "Conflict: HEAD"
\^^^^^^^^^^^^ meta.block.conflict.diff markup.inserted.diff meta.block.conflict.begin.diff
\^^^^^^ punctuation.section.block.begin.diff
\ ^^^^ entity.name.section.diff
Expand Down
5 changes: 4 additions & 1 deletion Git Formats/tests/syntax_test_git_diff.patch
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
\ SYNTAX TEST "Packages/Git Formats/Git Diff.sublime-syntax"
\ SYNTAX TEST partial-symbols "Packages/Git Formats/Git Diff.sublime-syntax"
From 8f72bad1baf19a53459661343e21d6491c3908d3 Mon Sep 17 00:00:00 2001
\ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ comment.line.diff
\ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constant.other.hash.git
Expand Down Expand Up @@ -75,11 +75,13 @@ Much better, no?

---
Gemfile | 1 +
\@@@@@@@ local-definition
\^^^^^^^ meta.toc-list.filename.diff meta.path.git string.unquoted.git
\ ^ punctuation.separator.sequence.diff
\ ^ meta.number.integer.decimal.diff constant.numeric.value.diff
\ ^ markup.inserted.diff
app/assets/images/logo.jpeg | Bin 0 -> 50966 bytes
\@@@@@@@@@@@@@@@@@@@@@@@@@@@ local-definition
\^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.toc-list.filename.diff meta.path.git string.unquoted.git
\ ^ punctuation.separator.path.diff
\ ^ punctuation.separator.path.diff
Expand All @@ -91,6 +93,7 @@ Much better, no?
\ ^^^^^ meta.number.integer.decimal.diff constant.numeric.value.diff markup.inserted.diff
\ ^^^^^ constant.numeric.suffix.diff
fonts/icomoon.eot | Bin 55452 -> 56000 bytes
\@@@@@@@@@@@@@@@@@ local-definition
3 files changed, 1 insertion(+)
\^ meta.number.integer.decimal.diff constant.numeric.value.diff
\ ^ punctuation.separator.sequence.diff
Expand Down

0 comments on commit 3a03a92

Please sign in to comment.