From 8248f6e4e1f3bbda18fc924ed26bc58a10cfdd2b Mon Sep 17 00:00:00 2001 From: Andreas Dangel Date: Thu, 26 May 2022 11:49:51 +0200 Subject: [PATCH] Fix unit tests --- .../pmd/lang/cs/cpd/testdata/attributes.txt | 400 +++++++++--------- .../cs/cpd/testdata/attributes_ignored.txt | 182 ++++---- .../lang/go/cpd/testdata/sample_unicode.txt | 148 +++---- .../python/cpd/testdata/sample_unicode.txt | 18 +- .../python/cpd/testdata/var_with_dollar.txt | 18 +- 5 files changed, 383 insertions(+), 383 deletions(-) diff --git a/pmd-cs/src/test/resources/net/sourceforge/pmd/lang/cs/cpd/testdata/attributes.txt b/pmd-cs/src/test/resources/net/sourceforge/pmd/lang/cs/cpd/testdata/attributes.txt index 403064af38..ec85e49500 100644 --- a/pmd-cs/src/test/resources/net/sourceforge/pmd/lang/cs/cpd/testdata/attributes.txt +++ b/pmd-cs/src/test/resources/net/sourceforge/pmd/lang/cs/cpd/testdata/attributes.txt @@ -1,229 +1,229 @@ [Image] or [Truncated image[ Bcol Ecol L1 - [\[] 1 1 - [Serializable] 2 13 - [\]] 14 14 + [\[] 1 2 + [Serializable] 2 14 + [\]] 14 15 L2 - [public] 1 6 - [class] 8 12 - [SampleClass] 14 24 + [public] 1 7 + [class] 8 13 + [SampleClass] 14 25 L3 - [{] 1 1 + [{] 1 2 L5 - [}] 1 1 + [}] 1 2 L7 - [\[] 1 1 - [System] 2 7 - [.] 8 8 - [Runtime] 9 15 - [.] 16 16 - [InteropServices] 17 31 - [.] 32 32 - [DllImport] 33 41 - [(] 42 42 - ["user32.dll"] 43 54 - [)] 55 55 - [\]] 56 56 + [\[] 1 2 + [System] 2 8 + [.] 8 9 + [Runtime] 9 16 + [.] 16 17 + [InteropServices] 17 32 + [.] 32 33 + [DllImport] 33 42 + [(] 42 43 + ["user32.dll"] 43 55 + [)] 55 56 + [\]] 56 57 L8 - [extern] 1 6 - [static] 8 13 - [void] 15 18 - [SampleMethod] 20 31 - [(] 32 32 - [)] 33 33 - [;] 34 34 + [extern] 1 7 + [static] 8 14 + [void] 15 19 + [SampleMethod] 20 32 + [(] 32 33 + [)] 33 34 + [;] 34 35 L10 - [void] 1 4 - [MethodA] 6 12 - [(] 13 13 - [\[] 14 14 - [In] 15 16 - [\]] 17 17 - [\[] 18 18 - [Out] 19 21 - [\]] 22 22 - [ref] 24 26 - [double] 28 33 - [x] 35 35 - [)] 36 36 - [{] 38 38 - [}] 40 40 + [void] 1 5 + [MethodA] 6 13 + [(] 13 14 + [\[] 14 15 + [In] 15 17 + [\]] 17 18 + [\[] 18 19 + [Out] 19 22 + [\]] 22 23 + [ref] 24 27 + [double] 28 34 + [x] 35 36 + [)] 36 37 + [{] 38 39 + [}] 40 41 L11 - [void] 1 4 - [MethodB] 6 12 - [(] 13 13 - [\[] 14 14 - [Out] 15 17 - [\]] 18 18 - [\[] 19 19 - [In] 20 21 - [\]] 22 22 - [ref] 24 26 - [double] 28 33 - [x] 35 35 - [)] 36 36 - [{] 38 38 - [}] 40 40 + [void] 1 5 + [MethodB] 6 13 + [(] 13 14 + [\[] 14 15 + [Out] 15 18 + [\]] 18 19 + [\[] 19 20 + [In] 20 22 + [\]] 22 23 + [ref] 24 27 + [double] 28 34 + [x] 35 36 + [)] 36 37 + [{] 38 39 + [}] 40 41 L12 - [void] 1 4 - [MethodC] 6 12 - [(] 13 13 - [\[] 14 14 - [In] 15 16 - [,] 17 17 - [Out] 19 21 - [\]] 22 22 - [ref] 24 26 - [double] 28 33 - [x] 35 35 - [)] 36 36 - [{] 38 38 - [}] 40 40 + [void] 1 5 + [MethodC] 6 13 + [(] 13 14 + [\[] 14 15 + [In] 15 17 + [,] 17 18 + [Out] 19 22 + [\]] 22 23 + [ref] 24 27 + [double] 28 34 + [x] 35 36 + [)] 36 37 + [{] 38 39 + [}] 40 41 L14 - [\[] 1 1 - [Conditional] 2 12 - [(] 13 13 - ["DEBUG"] 14 20 - [)] 21 21 - [,] 22 22 - [Conditional] 24 34 - [(] 35 35 - ["TEST1"] 36 42 - [)] 43 43 - [\]] 44 44 + [\[] 1 2 + [Conditional] 2 13 + [(] 13 14 + ["DEBUG"] 14 21 + [)] 21 22 + [,] 22 23 + [Conditional] 24 35 + [(] 35 36 + ["TEST1"] 36 43 + [)] 43 44 + [\]] 44 45 L15 - [void] 1 4 - [TraceMethod] 6 16 - [(] 17 17 - [)] 18 18 + [void] 1 5 + [TraceMethod] 6 17 + [(] 17 18 + [)] 18 19 L16 - [{] 1 1 + [{] 1 2 L18 - [}] 1 1 + [}] 1 2 L20 - [\[] 1 1 - [DllImport] 2 10 - [(] 11 11 - ["user32.dll"] 12 23 - [)] 24 24 - [\]] 25 25 + [\[] 1 2 + [DllImport] 2 11 + [(] 11 12 + ["user32.dll"] 12 24 + [)] 24 25 + [\]] 25 26 L21 - [\[] 1 1 - [DllImport] 2 10 - [(] 11 11 - ["user32.dll"] 12 23 - [,] 24 24 - [SetLastError] 26 37 - [=] 38 38 - [false] 39 43 - [,] 44 44 - [ExactSpelling] 46 58 - [=] 59 59 - [false] 60 64 - [)] 65 65 - [\]] 66 66 + [\[] 1 2 + [DllImport] 2 11 + [(] 11 12 + ["user32.dll"] 12 24 + [,] 24 25 + [SetLastError] 26 38 + [=] 38 39 + [false] 39 44 + [,] 44 45 + [ExactSpelling] 46 59 + [=] 59 60 + [false] 60 65 + [)] 65 66 + [\]] 66 67 L22 - [\[] 1 1 - [DllImport] 2 10 - [(] 11 11 - ["user32.dll"] 12 23 - [,] 24 24 - [ExactSpelling] 26 38 - [=] 39 39 - [false] 40 44 - [,] 45 45 - [SetLastError] 47 58 - [=] 59 59 - [false] 60 64 - [)] 65 65 - [\]] 66 66 + [\[] 1 2 + [DllImport] 2 11 + [(] 11 12 + ["user32.dll"] 12 24 + [,] 24 25 + [ExactSpelling] 26 39 + [=] 39 40 + [false] 40 45 + [,] 45 46 + [SetLastError] 47 59 + [=] 59 60 + [false] 60 65 + [)] 65 66 + [\]] 66 67 L24 - [using] 1 5 - [System] 7 12 - [;] 13 13 + [using] 1 6 + [System] 7 13 + [;] 13 14 L25 - [using] 1 5 - [System] 7 12 - [.] 13 13 - [Reflection] 14 23 - [;] 24 24 + [using] 1 6 + [System] 7 13 + [.] 13 14 + [Reflection] 14 24 + [;] 24 25 L26 - [\[] 1 1 - [assembly] 2 9 - [:] 10 10 - [AssemblyTitleAttribute] 12 33 - [(] 34 34 - ["Production assembly 4"] 35 57 - [)] 58 58 - [\]] 59 59 + [\[] 1 2 + [assembly] 2 10 + [:] 10 11 + [AssemblyTitleAttribute] 12 34 + [(] 34 35 + ["Production assembly 4"] 35 58 + [)] 58 59 + [\]] 59 60 L27 - [\[] 1 1 - [module] 2 7 - [:] 8 8 - [CLSCompliant] 10 21 - [(] 22 22 - [true] 23 26 - [)] 27 27 - [\]] 28 28 + [\[] 1 2 + [module] 2 8 + [:] 8 9 + [CLSCompliant] 10 22 + [(] 22 23 + [true] 23 27 + [)] 27 28 + [\]] 28 29 L30 - [\[] 1 1 - [ValidatedContract] 2 18 - [\]] 19 19 + [\[] 1 2 + [ValidatedContract] 2 19 + [\]] 19 20 L31 - [int] 1 3 - [Method1] 5 11 - [(] 12 12 - [)] 13 13 - [{] 15 15 - [return] 17 22 - [0] 24 24 - [;] 25 25 - [}] 27 27 + [int] 1 4 + [Method1] 5 12 + [(] 12 13 + [)] 13 14 + [{] 15 16 + [return] 17 23 + [0] 24 25 + [;] 25 26 + [}] 27 28 L34 - [\[] 1 1 - [method] 2 7 - [:] 8 8 - [ValidatedContract] 10 26 - [\]] 27 27 + [\[] 1 2 + [method] 2 8 + [:] 8 9 + [ValidatedContract] 10 27 + [\]] 27 28 L35 - [int] 1 3 - [Method2] 5 11 - [(] 12 12 - [)] 13 13 - [{] 15 15 - [return] 17 22 - [0] 24 24 - [;] 25 25 - [}] 27 27 + [int] 1 4 + [Method2] 5 12 + [(] 12 13 + [)] 13 14 + [{] 15 16 + [return] 17 23 + [0] 24 25 + [;] 25 26 + [}] 27 28 L38 - [int] 1 3 - [Method3] 5 11 - [(] 12 12 - [\[] 13 13 - [ValidatedContract] 14 30 - [\]] 31 31 - [string] 33 38 - [contract] 40 47 - [)] 48 48 - [{] 50 50 - [return] 52 57 - [0] 59 59 - [;] 60 60 - [}] 62 62 + [int] 1 4 + [Method3] 5 12 + [(] 12 13 + [\[] 13 14 + [ValidatedContract] 14 31 + [\]] 31 32 + [string] 33 39 + [contract] 40 48 + [)] 48 49 + [{] 50 51 + [return] 52 58 + [0] 59 60 + [;] 60 61 + [}] 62 63 L41 - [\[] 1 1 - [return] 2 7 - [:] 8 8 - [ValidatedContract] 10 26 - [\]] 27 27 + [\[] 1 2 + [return] 2 8 + [:] 8 9 + [ValidatedContract] 10 27 + [\]] 27 28 L42 - [int] 1 3 - [Method4] 5 11 - [(] 12 12 - [)] 13 13 - [{] 15 15 - [return] 17 22 - [0] 24 24 - [;] 25 25 - [}] 27 27 + [int] 1 4 + [Method4] 5 12 + [(] 12 13 + [)] 13 14 + [{] 15 16 + [return] 17 23 + [0] 24 25 + [;] 25 26 + [}] 27 28 EOF diff --git a/pmd-cs/src/test/resources/net/sourceforge/pmd/lang/cs/cpd/testdata/attributes_ignored.txt b/pmd-cs/src/test/resources/net/sourceforge/pmd/lang/cs/cpd/testdata/attributes_ignored.txt index 0796c4384c..c2de96f13f 100644 --- a/pmd-cs/src/test/resources/net/sourceforge/pmd/lang/cs/cpd/testdata/attributes_ignored.txt +++ b/pmd-cs/src/test/resources/net/sourceforge/pmd/lang/cs/cpd/testdata/attributes_ignored.txt @@ -1,109 +1,109 @@ [Image] or [Truncated image[ Bcol Ecol L2 - [public] 1 6 - [class] 8 12 - [SampleClass] 14 24 + [public] 1 7 + [class] 8 13 + [SampleClass] 14 25 L3 - [{] 1 1 + [{] 1 2 L5 - [}] 1 1 + [}] 1 2 L8 - [extern] 1 6 - [static] 8 13 - [void] 15 18 - [SampleMethod] 20 31 - [(] 32 32 - [)] 33 33 - [;] 34 34 + [extern] 1 7 + [static] 8 14 + [void] 15 19 + [SampleMethod] 20 32 + [(] 32 33 + [)] 33 34 + [;] 34 35 L10 - [void] 1 4 - [MethodA] 6 12 - [(] 13 13 - [ref] 24 26 - [double] 28 33 - [x] 35 35 - [)] 36 36 - [{] 38 38 - [}] 40 40 + [void] 1 5 + [MethodA] 6 13 + [(] 13 14 + [ref] 24 27 + [double] 28 34 + [x] 35 36 + [)] 36 37 + [{] 38 39 + [}] 40 41 L11 - [void] 1 4 - [MethodB] 6 12 - [(] 13 13 - [ref] 24 26 - [double] 28 33 - [x] 35 35 - [)] 36 36 - [{] 38 38 - [}] 40 40 + [void] 1 5 + [MethodB] 6 13 + [(] 13 14 + [ref] 24 27 + [double] 28 34 + [x] 35 36 + [)] 36 37 + [{] 38 39 + [}] 40 41 L12 - [void] 1 4 - [MethodC] 6 12 - [(] 13 13 - [ref] 24 26 - [double] 28 33 - [x] 35 35 - [)] 36 36 - [{] 38 38 - [}] 40 40 + [void] 1 5 + [MethodC] 6 13 + [(] 13 14 + [ref] 24 27 + [double] 28 34 + [x] 35 36 + [)] 36 37 + [{] 38 39 + [}] 40 41 L15 - [void] 1 4 - [TraceMethod] 6 16 - [(] 17 17 - [)] 18 18 + [void] 1 5 + [TraceMethod] 6 17 + [(] 17 18 + [)] 18 19 L16 - [{] 1 1 + [{] 1 2 L18 - [}] 1 1 + [}] 1 2 L24 - [using] 1 5 - [System] 7 12 - [;] 13 13 + [using] 1 6 + [System] 7 13 + [;] 13 14 L25 - [using] 1 5 - [System] 7 12 - [.] 13 13 - [Reflection] 14 23 - [;] 24 24 + [using] 1 6 + [System] 7 13 + [.] 13 14 + [Reflection] 14 24 + [;] 24 25 L31 - [int] 1 3 - [Method1] 5 11 - [(] 12 12 - [)] 13 13 - [{] 15 15 - [return] 17 22 - [0] 24 24 - [;] 25 25 - [}] 27 27 + [int] 1 4 + [Method1] 5 12 + [(] 12 13 + [)] 13 14 + [{] 15 16 + [return] 17 23 + [0] 24 25 + [;] 25 26 + [}] 27 28 L35 - [int] 1 3 - [Method2] 5 11 - [(] 12 12 - [)] 13 13 - [{] 15 15 - [return] 17 22 - [0] 24 24 - [;] 25 25 - [}] 27 27 + [int] 1 4 + [Method2] 5 12 + [(] 12 13 + [)] 13 14 + [{] 15 16 + [return] 17 23 + [0] 24 25 + [;] 25 26 + [}] 27 28 L38 - [int] 1 3 - [Method3] 5 11 - [(] 12 12 - [string] 33 38 - [contract] 40 47 - [)] 48 48 - [{] 50 50 - [return] 52 57 - [0] 59 59 - [;] 60 60 - [}] 62 62 + [int] 1 4 + [Method3] 5 12 + [(] 12 13 + [string] 33 39 + [contract] 40 48 + [)] 48 49 + [{] 50 51 + [return] 52 58 + [0] 59 60 + [;] 60 61 + [}] 62 63 L42 - [int] 1 3 - [Method4] 5 11 - [(] 12 12 - [)] 13 13 - [{] 15 15 - [return] 17 22 - [0] 24 24 - [;] 25 25 - [}] 27 27 + [int] 1 4 + [Method4] 5 12 + [(] 12 13 + [)] 13 14 + [{] 15 16 + [return] 17 23 + [0] 24 25 + [;] 25 26 + [}] 27 28 EOF diff --git a/pmd-go/src/test/resources/net/sourceforge/pmd/lang/go/cpd/testdata/sample_unicode.txt b/pmd-go/src/test/resources/net/sourceforge/pmd/lang/go/cpd/testdata/sample_unicode.txt index f1b02aef86..ecc27507ff 100644 --- a/pmd-go/src/test/resources/net/sourceforge/pmd/lang/go/cpd/testdata/sample_unicode.txt +++ b/pmd-go/src/test/resources/net/sourceforge/pmd/lang/go/cpd/testdata/sample_unicode.txt @@ -1,89 +1,89 @@ [Image] or [Truncated image[ Bcol Ecol L1 - [func] 1 4 - [main] 6 9 - [(] 10 10 - [)] 11 11 - [{] 13 13 + [func] 1 5 + [main] 6 10 + [(] 10 11 + [)] 11 12 + [{] 13 14 L3 - [str] 2 4 - [:=] 6 7 - ["hello world"] 9 21 + [str] 2 5 + [:=] 6 8 + ["hello world"] 9 22 L4 - [slice] 2 6 - [:=] 8 9 - [str] 11 13 - [\[] 14 14 - [4] 15 15 - [:] 16 16 - [\]] 17 17 + [slice] 2 7 + [:=] 8 10 + [str] 11 14 + [\[] 14 15 + [4] 15 16 + [:] 16 17 + [\]] 17 18 L5 - [fmt] 2 4 - [.] 5 5 - [Println] 6 12 - [(] 13 13 - [slice] 14 18 - [)] 19 19 + [fmt] 2 5 + [.] 5 6 + [Println] 6 13 + [(] 13 14 + [slice] 14 19 + [)] 19 20 L9 - [bytes] 2 6 - [:=] 8 9 - [\[] 11 11 - [\]] 12 12 - [byte] 13 16 - [(] 17 17 - [str] 18 20 - [)] 21 21 + [bytes] 2 7 + [:=] 8 10 + [\[] 11 12 + [\]] 12 13 + [byte] 13 17 + [(] 17 18 + [str] 18 21 + [)] 21 22 L10 - [bytes] 2 6 - [\[] 7 7 - [2] 8 8 - [\]] 9 9 - [=] 11 11 - ['x'] 13 15 + [bytes] 2 7 + [\[] 7 8 + [2] 8 9 + [\]] 9 10 + [=] 11 12 + ['x'] 13 16 L11 - [str] 2 4 - [=] 6 6 - [string] 8 13 - [(] 14 14 - [bytes] 15 19 - [)] 20 20 + [str] 2 5 + [=] 6 7 + [string] 8 14 + [(] 14 15 + [bytes] 15 20 + [)] 20 21 L12 - [fmt] 2 4 - [.] 5 5 - [Println] 6 12 - [(] 13 13 - [str] 14 16 - [)] 17 17 + [fmt] 2 5 + [.] 5 6 + [Println] 6 13 + [(] 13 14 + [str] 14 17 + [)] 17 18 L15 - [runes] 2 6 - [:=] 8 9 - [\[] 11 11 - [\]] 12 12 - [rune] 13 16 - [(] 17 17 - [str] 18 20 - [)] 21 21 + [runes] 2 7 + [:=] 8 10 + [\[] 11 12 + [\]] 12 13 + [rune] 13 17 + [(] 17 18 + [str] 18 21 + [)] 21 22 L16 - [runes] 2 6 - [\[] 7 7 - [0] 8 8 - [\]] 9 9 - [=] 11 11 - ['哈'] 13 15 + [runes] 2 7 + [\[] 7 8 + [0] 8 9 + [\]] 9 10 + [=] 11 12 + ['哈'] 13 16 L17 - [str] 2 4 - [=] 6 6 - [string] 8 13 - [(] 14 14 - [runes] 15 19 - [)] 20 20 + [str] 2 5 + [=] 6 7 + [string] 8 14 + [(] 14 15 + [runes] 15 20 + [)] 20 21 L18 - [fmt] 2 4 - [.] 5 5 - [Println] 6 12 - [(] 13 13 - [str] 14 16 - [)] 17 17 + [fmt] 2 5 + [.] 5 6 + [Println] 6 13 + [(] 13 14 + [str] 14 17 + [)] 17 18 L20 - [}] 1 1 + [}] 1 2 EOF diff --git a/pmd-python/src/test/resources/net/sourceforge/pmd/lang/python/cpd/testdata/sample_unicode.txt b/pmd-python/src/test/resources/net/sourceforge/pmd/lang/python/cpd/testdata/sample_unicode.txt index 9476d45ba4..ec7d598bfc 100644 --- a/pmd-python/src/test/resources/net/sourceforge/pmd/lang/python/cpd/testdata/sample_unicode.txt +++ b/pmd-python/src/test/resources/net/sourceforge/pmd/lang/python/cpd/testdata/sample_unicode.txt @@ -1,13 +1,13 @@ [Image] or [Truncated image[ Bcol Ecol L3 - [def] 1 3 - [check] 5 9 - [(] 10 10 - [)] 11 11 - [:] 12 12 + [def] 1 4 + [check] 5 10 + [(] 10 11 + [)] 11 12 + [:] 12 13 L4 - [total_cost_μs] 5 17 - [=] 19 19 - [\[] 21 21 - [\]] 22 22 + [total_cost_μs] 5 18 + [=] 19 20 + [\[] 21 22 + [\]] 22 23 EOF diff --git a/pmd-python/src/test/resources/net/sourceforge/pmd/lang/python/cpd/testdata/var_with_dollar.txt b/pmd-python/src/test/resources/net/sourceforge/pmd/lang/python/cpd/testdata/var_with_dollar.txt index 39607ea38f..07eeb8ba7d 100644 --- a/pmd-python/src/test/resources/net/sourceforge/pmd/lang/python/cpd/testdata/var_with_dollar.txt +++ b/pmd-python/src/test/resources/net/sourceforge/pmd/lang/python/cpd/testdata/var_with_dollar.txt @@ -1,13 +1,13 @@ [Image] or [Truncated image[ Bcol Ecol L1 - [def] 1 3 - [check] 5 9 - [(] 10 10 - [)] 11 11 - [:] 12 12 + [def] 1 4 + [check] 5 10 + [(] 10 11 + [)] 11 12 + [:] 12 13 L2 - [a$a] 5 7 - [=] 9 9 - [\[] 11 11 - [\]] 12 12 + [a$a] 5 8 + [=] 9 10 + [\[] 11 12 + [\]] 12 13 EOF