pvn 0.0.7 → 0.0.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (111) hide show
  1. data/bin/change.rb +50 -0
  2. data/bin/pvn +8 -4
  3. data/bin/quote.rb +18 -6
  4. data/bin/quotes.orig.txt +145 -0
  5. data/bin/quotes.txt +64 -0
  6. data/lib/pvn/app/runner.rb +103 -0
  7. data/lib/pvn/app.rb +1 -142
  8. data/lib/pvn/{subcommands/base → command}/color_option.rb +1 -1
  9. data/lib/pvn/{subcommands/base → command}/command.rb +10 -6
  10. data/lib/pvn/{subcommands/base → command}/doc.rb +2 -2
  11. data/lib/pvn/{subcommands/base → command}/options.rb +2 -2
  12. data/lib/pvn/config.rb +14 -1
  13. data/lib/pvn/{subcommands/diff → diff}/command.rb +6 -6
  14. data/lib/pvn/diff/differ.rb +60 -44
  15. data/lib/pvn/diff/local_differ.rb +99 -0
  16. data/lib/pvn/diff/log_paths.rb +46 -0
  17. data/lib/pvn/{subcommands/diff → diff}/options.rb +8 -6
  18. data/lib/pvn/diff/path.rb +52 -0
  19. data/lib/pvn/diff/path_revision.rb +31 -0
  20. data/lib/pvn/diff/paths.rb +42 -0
  21. data/lib/pvn/diff/repository_differ.rb +154 -0
  22. data/lib/pvn/diff/revision.rb +36 -0
  23. data/lib/pvn/diff/status_paths.rb +87 -0
  24. data/lib/pvn/io/element.rb +29 -8
  25. data/lib/pvn/{subcommands/log → log}/command.rb +4 -4
  26. data/lib/pvn/log/formatter/log_formatter.rb +1 -1
  27. data/lib/pvn/{subcommands/log → log}/options.rb +7 -7
  28. data/lib/pvn/{subcommands/pct → pct}/command.rb +6 -6
  29. data/lib/pvn/{subcommands/pct → pct}/diffcount.rb +1 -1
  30. data/lib/pvn/{subcommands/pct → pct}/differ.rb +2 -2
  31. data/lib/pvn/{subcommands/pct → pct}/local_differ.rb +3 -3
  32. data/lib/pvn/pct/options.rb +12 -0
  33. data/lib/pvn/{subcommands/pct → pct}/repository_differ.rb +5 -13
  34. data/lib/pvn/revision/{entry.rb → argument.rb} +45 -30
  35. data/lib/pvn/{subcommands/revision → revision}/base_option.rb +2 -2
  36. data/lib/pvn/revision/error.rb +11 -0
  37. data/lib/pvn/{subcommands/revision → revision}/multiple_revisions_option.rb +1 -1
  38. data/lib/pvn/revision/range.rb +49 -0
  39. data/lib/pvn/{subcommands/revision → revision}/revision_option.rb +1 -8
  40. data/lib/pvn/{subcommands/revision → revision}/revision_regexp_option.rb +2 -2
  41. data/lib/pvn/{subcommands/status → status}/command.rb +6 -6
  42. data/lib/pvn/status/formatter/status_formatter.rb +1 -1
  43. data/lib/pvn/status/options.rb +12 -0
  44. data/lib/pvn/{base/util.rb → util/array.rb} +2 -1
  45. data/lib/pvn.rb +1 -6
  46. data/lib/svnx/action.rb +52 -0
  47. data/lib/svnx/entries.rb +9 -1
  48. data/lib/svnx/log/command.rb +4 -3
  49. data/lib/svnx/status/entry.rb +30 -13
  50. data/lib/synoption/base_option.rb +10 -27
  51. data/lib/synoption/matchers.rb +22 -0
  52. data/lib/system/command/cachefile.rb +28 -14
  53. data/lib/system/command.rb +1 -1
  54. data/test/integration/pvn/diff/command_test.rb +20 -0
  55. data/test/integration/pvn/diff/local_differ_test.rb +72 -0
  56. data/test/integration/pvn/diff/log_paths_test.rb +28 -0
  57. data/test/integration/pvn/diff/repository_differ_test.rb +127 -0
  58. data/test/integration/pvn/diff/status_paths_test.rb +31 -0
  59. data/test/integration/pvn/log/command_test.rb +29 -0
  60. data/test/integration/pvn/pct/command_test.rb +30 -0
  61. data/test/integration/pvn/status/command_test.rb +26 -0
  62. data/test/unit/pvn/app_test.rb +7 -5
  63. data/test/unit/pvn/diff/path_revision_test.rb +45 -0
  64. data/test/unit/pvn/diff/path_test.rb +38 -0
  65. data/test/unit/pvn/diff/revision_test.rb +35 -0
  66. data/test/unit/pvn/io/element/log/log_test.rb +2 -2
  67. data/test/unit/pvn/log/formatter/entry_formatter_test.rb +40 -29
  68. data/test/unit/pvn/{subcommands/log → log}/options_test.rb +4 -4
  69. data/test/unit/pvn/revision/argument_test.rb +157 -0
  70. data/test/unit/pvn/{subcommands/revision → revision}/multiple_revisions_option_test.rb +10 -11
  71. data/test/unit/pvn/revision/range_test.rb +26 -0
  72. data/test/unit/pvn/{subcommands/revision → revision}/revision_option_test.rb +13 -18
  73. data/test/unit/pvn/{subcommands/revision → revision}/revision_regexp_option_test.rb +8 -10
  74. data/test/unit/svnx/action_test.rb +67 -0
  75. data/test/unit/svnx/info/entries_test.rb +10 -10
  76. data/test/unit/svnx/info/entry_test.rb +7 -10
  77. data/test/unit/svnx/log/entries_test.rb +31 -29
  78. data/test/unit/svnx/log/entry_test.rb +3 -7
  79. data/test/unit/svnx/status/entries_test.rb +7 -6
  80. data/test/unit/svnx/status/entry_test.rb +2 -23
  81. data/test/unit/system/command/cachefile_test.rb +53 -0
  82. data/test/unit/system/command/caching_test.rb +14 -23
  83. metadata +83 -64
  84. data/lib/pvn/describe.rb +0 -40
  85. data/lib/pvn/diff/diffcmd.rb +0 -49
  86. data/lib/pvn/diff/diffopts.rb +0 -58
  87. data/lib/pvn/log/logcmd.rb +0 -135
  88. data/lib/pvn/log/logentry.rb +0 -116
  89. data/lib/pvn/log/logfactory.rb +0 -101
  90. data/lib/pvn/log/logoptions.rb +0 -43
  91. data/lib/pvn/revision.rb +0 -119
  92. data/lib/pvn/subcommands/diff/differ.rb +0 -65
  93. data/lib/pvn/subcommands/diff/local_differ.rb +0 -103
  94. data/lib/pvn/subcommands/diff/repository_differ.rb +0 -145
  95. data/lib/pvn/subcommands/pct/clargs.rb +0 -33
  96. data/lib/pvn/subcommands/pct/options.rb +0 -12
  97. data/lib/pvn/subcommands/status/options.rb +0 -12
  98. data/lib/pvn/svn/command/svncmd.rb +0 -39
  99. data/lib/pvn/svn/environment.rb +0 -23
  100. data/lib/pvn/svn/svnelement.rb +0 -89
  101. data/lib/pvn/svn/svninfo.rb +0 -42
  102. data/lib/pvn/svn/svnroot.rb +0 -29
  103. data/lib/pvn/upp/uppcmd.rb +0 -112
  104. data/lib/pvn/wherecmd.rb +0 -55
  105. data/test/integration/pvn/subcommands/diff/command_test.rb +0 -153
  106. data/test/integration/pvn/subcommands/log/command_test.rb +0 -22
  107. data/test/integration/svnx/log/test.rb +0 -43
  108. data/test/unit/pvn/revision/entry_test.rb +0 -110
  109. /data/lib/pvn/{subcommands/base → command}/clargs.rb +0 -0
  110. /data/lib/pvn/{base → util}/color_formatter.rb +0 -0
  111. /data/lib/pvn/{base → util}/textlines.rb +0 -0
@@ -0,0 +1,26 @@
1
+ #!/usr/bin/ruby -w
2
+ # -*- ruby -*-
3
+
4
+ require 'integration/tc'
5
+ require 'pvn/status/command'
6
+ require 'resources'
7
+ require 'stringio'
8
+
9
+ Log.level = Log::DEBUG
10
+
11
+ module PVN::Status
12
+ class CommandTest < PVN::IntegrationTestCase
13
+
14
+ def test_local
15
+ explines = Array.new
16
+
17
+ explines << " \e[33mFirstFile.txt\e[0m"
18
+ explines << " \e[32mSeventhFile.txt\e[0m"
19
+ explines << " \e[31mdirzero/SixthFile.txt\e[0m"
20
+ explines << " src/java/Charlie.java"
21
+ explines << " \e[32msrc/ruby/dog.rb\e[0m"
22
+
23
+ assert_command_output PVN::Status::Command, %w{ }, explines
24
+ end
25
+ end
26
+ end
@@ -1,20 +1,22 @@
1
1
  require 'tc'
2
2
  require 'pvn/app'
3
+ require 'stringio'
3
4
 
4
5
  class TestPVNCli < PVN::TestCase
5
6
  def setup
6
- PVN::App::Runner.execute @stdout_io = StringIO.new, Array.new
7
- @stdout_io.rewind
8
- @stdout = @stdout_io.read
7
+ stdout_io = StringIO.new
8
+ # PVN::App::Runner.new stdout_io, Array.new
9
+ # stdout_io.rewind
10
+ @stdout = stdout_io.string
9
11
  end
10
12
 
11
- def test_print_default_output
13
+ def xxx_test_print_default_output
12
14
  # assert_match(/To update this executable/, @stdout)
13
15
  end
14
16
 
15
17
  def xxx_test_help
16
18
  io = StringIO.new
17
- PVN::App::Runner.execute io, %w{ --help }
19
+ PVN::App::Runner.new io, %w{ --help }
18
20
  io.rewind
19
21
  io = io.read
20
22
  # assert_match(/To update this executable/, io)
@@ -0,0 +1,45 @@
1
+ #!/usr/bin/ruby -w
2
+ # -*- ruby -*-
3
+
4
+ require 'tc'
5
+ require 'pvn/diff/path_revision'
6
+
7
+ module PVN::Diff
8
+ ### $$$ yes, a lot of this is the same as Path; there is overlap as Path
9
+ ### changes to a collection of PathRevisions
10
+ class PathRevisionTestCase < PVN::TestCase
11
+ def create_pathrev revision, action
12
+ PathRevision.new revision, action
13
+ end
14
+
15
+ def assert_pathrev_revision exprevision, revision
16
+ prev = create_pathrev revision, "added"
17
+ assert_equal exprevision, prev.revision
18
+ end
19
+
20
+ def assert_pathrev_action expaction, action
21
+ prev = create_pathrev "0", action
22
+ assert_equal expaction, prev.action
23
+ end
24
+
25
+ def test_init_revision_string
26
+ assert_pathrev_revision "0", "0"
27
+ end
28
+
29
+ def test_init_revision_integer
30
+ assert_pathrev_revision "0", 0
31
+ end
32
+
33
+ def test_init_action_long_string
34
+ assert_pathrev_action SVNx::Action.new(:added), "added"
35
+ end
36
+
37
+ def test_init_action_short_string
38
+ assert_pathrev_action SVNx::Action.new(:deleted), "D"
39
+ end
40
+
41
+ def test_init_action_symbol
42
+ assert_pathrev_action SVNx::Action.new(:modified), :modified
43
+ end
44
+ end
45
+ end
@@ -0,0 +1,38 @@
1
+ #!/usr/bin/ruby -w
2
+ # -*- ruby -*-
3
+
4
+ require 'tc'
5
+ require 'pvn/diff/path'
6
+
7
+ module PVN::Diff
8
+ class PathTestCase < PVN::TestCase
9
+ def create_path name, revision, action, url
10
+ Path.new name, revision, action, url
11
+ end
12
+
13
+ def assert_path_name expname, name
14
+ logpath = create_path name, "0", "added", "file:///var/svn/repo"
15
+ assert_equal expname, logpath.name
16
+ end
17
+
18
+ def assert_path_url expurl, url
19
+ logpath = create_path "File.txt", "0", "deleted", url
20
+ assert_equal expurl, logpath.url
21
+ end
22
+
23
+ def test_init_name
24
+ assert_path_name "File.txt", "File.txt"
25
+ end
26
+
27
+ def test_init_url
28
+ assert_path_url "file:///var/svn/repo", "file:///var/svn/repo"
29
+ end
30
+
31
+ def test_add_revision
32
+ path = create_path "File.txt", "0", :added, "file:///var/svn/repo"
33
+ assert_equal 1, path.path_revisions.size
34
+ path.add_revision "1", :modified
35
+ assert_equal 2, path.path_revisions.size
36
+ end
37
+ end
38
+ end
@@ -0,0 +1,35 @@
1
+ #!/usr/bin/ruby -w
2
+ # -*- ruby -*-
3
+
4
+ require 'tc'
5
+ require 'pvn/diff/revision'
6
+
7
+ module PVN::Diff
8
+ class RevisionTestCase < PVN::TestCase
9
+ def to_message change, revision
10
+ "change: #{change}; revision: #{revision}"
11
+ end
12
+
13
+ def assert_revision_to_s expstr, change, revision
14
+ rev = RevisionRange.new change, revision
15
+ assert_equal expstr, rev.to_s, "change: #{change}; revision: #{revision}"
16
+ end
17
+
18
+ def assert_revision_gt exp, chgx, revx, chgy, revy
19
+ x = RevisionRange.new chgx, revx
20
+ y = RevisionRange.new chgx, revy
21
+ msg = "x: #{to_message(chgx, revx)}; y: #{to_message(chgy, revy)}"
22
+ info "x: #{x}".cyan
23
+ info "y: #{y}".cyan
24
+ assert_equal exp, x > y, msg
25
+ end
26
+
27
+ def test_change_str
28
+ assert_revision_to_s '14:15', '15', nil
29
+ end
30
+
31
+ def test_revision_str
32
+ assert_revision_to_s '14:15', nil, [ '14', '15' ]
33
+ end
34
+ end
35
+ end
@@ -26,11 +26,11 @@ module PVN::IO::IOElement
26
26
  end
27
27
 
28
28
  def test_options_none
29
- assert_log_command 163, Resources::WIQTR_PATH
29
+ assert_log_command 163, Resources::PT_PATH
30
30
  end
31
31
 
32
32
  def test_option_limit
33
- assert_log_command 15, Resources::WIQTR_PATH, :limit => 15
33
+ assert_log_command 15, Resources::PT_PATH, :limit => 15
34
34
  end
35
35
  end
36
36
  end
@@ -6,13 +6,11 @@ require 'svnx/log/entries'
6
6
  require 'pvn/io/element'
7
7
  require 'pvn/log/formatter/entry_formatter'
8
8
 
9
- require 'resources'
10
-
11
9
  module PVN; module Log; end; end
12
10
 
13
11
  module PVN::Log
14
12
  class EntryFormatTestCase < PVN::TestCase
15
- TEST_LINES = Resources::WIQTR_LOG_L_15_V.readlines
13
+ TEST_LINES = Resources::PT_LOG_R19_1_V.readlines
16
14
  ENTRIES = SVNx::Log::Entries.new :xmllines => TEST_LINES
17
15
 
18
16
  def show_all entries, from_head, from_tail
@@ -20,71 +18,84 @@ module PVN::Log
20
18
  puts ef.format
21
19
  end
22
20
 
23
- def assert_format explines, entry, use_colors, idx, from_head, from_tail, total
21
+ def assert_format explines, use_colors, idx, from_head, from_tail
22
+ total = 15
23
+ entry = ENTRIES[idx]
24
24
  ef = EntryFormatter.new use_colors, entry, idx, from_head, from_tail, total
25
25
 
26
26
  fmtlines = ef.format
27
- assert_equal explines, fmtlines
27
+ # assert_equal explines, fmtlines
28
+ (0 .. [ explines.length, fmtlines.length ].max).each do |lnum|
29
+ assert_equal explines[lnum], fmtlines[lnum], "line: #{lnum}"
30
+ end
28
31
  end
29
32
 
30
33
  def test_colors_from_head_not_from_tail_index_0
31
34
  entries = ENTRIES
32
35
  explines = [
33
- "\e[1m1950\e[0m \e[1m-1\e[0m \e[36m\e[1mjpace\e[0m\e[0m \e[35m\e[1m2011-12-05T12:41:52.385786Z\e[0m\e[0m",
36
+ "\e[1m19\e[0m \e[1m-1\e[0m \e[36m\e[1mLili von Shtupp\e[0m\e[0m \e[35m\e[1m2012-09-16T14:24:07.913759Z\e[0m\e[0m",
34
37
  "",
35
- "\e[37mTesting.\e[0m",
38
+ "\e[37m\e[0m",
36
39
  "",
37
- " \e[33m/trunk/buildNumber.properties\e[0m"
40
+ " \e[33m/SecondFile.txt\e[0m"
38
41
  ]
39
- assert_format explines, entries[0], true, 0, true, false, 15
42
+ assert_format explines, true, 0, true, false
40
43
  end
41
44
 
42
- def test_colors_from_head_not_from_tail_index_4
45
+ def test_colors_from_head_not_from_tail_index_3
43
46
  entries = ENTRIES
44
47
  explines = [
45
- "\e[1m1950\e[0m \e[1m-5\e[0m \e[36m\e[1mjpace\e[0m\e[0m \e[35m\e[1m2011-12-05T12:41:52.385786Z\e[0m\e[0m",
48
+ "\e[1m16\e[0m \e[1m-4\e[0m \e[36m\e[1mBuddy Bizarre\e[0m\e[0m \e[35m\e[1m2012-09-16T14:07:30.329525Z\e[0m\e[0m",
46
49
  "",
47
- "\e[37mTesting.\e[0m",
50
+ "\e[37mCUT! What in the hell do you think you're doing here? This is a closed set.\e[0m",
48
51
  "",
49
- " \e[33m/trunk/buildNumber.properties\e[0m"
52
+ "\e[1m \e[32m/src/java\e[0m\e[0m",
53
+ " \e[32m/src/java/Alpha.java\e[0m",
54
+ " \e[32m/src/java/Bravo.java\e[0m"
50
55
  ]
51
- assert_format explines, entries[0], true, 4, true, false, 15
56
+ assert_format explines, true, 3, true, false
52
57
  end
53
58
 
54
- def test_no_colors_from_head_from_tail_index_4
59
+ def test_no_colors_from_head_from_tail_index_3
55
60
  entries = ENTRIES
56
61
  explines = [
57
- "1950 -5 +10 jpace 2011-12-05T12:41:52.385786Z",
62
+ "16 -4 +11 Buddy Bizarre 2012-09-16T14:07:30.329525Z",
58
63
  "",
59
- "Testing.",
64
+ "CUT! What in the hell do you think you're doing here? This is a closed set.",
60
65
  "",
61
- " /trunk/buildNumber.properties"
66
+ " /src/java",
67
+ " /src/java/Alpha.java",
68
+ " /src/java/Bravo.java"
62
69
  ]
63
- assert_format explines, entries[0], false, 4, true, true, 15
70
+ assert_format explines, false, 3, true, true
64
71
  end
65
72
 
66
- def test_colors_from_head_from_tail_index_4
73
+ def test_colors_from_head_from_tail_index_3
67
74
  entries = ENTRIES
68
75
  explines = [
69
- "\e[1m1950\e[0m \e[1m-5\e[0m \e[1m+10\e[0m \e[36m\e[1mjpace\e[0m\e[0m \e[35m\e[1m2011-12-05T12:41:52.385786Z\e[0m\e[0m",
76
+ "\e[1m16\e[0m \e[1m-4\e[0m \e[1m+11\e[0m \e[36m\e[1mBuddy Bizarre\e[0m\e[0m \e[35m\e[1m2012-09-16T14:07:30.329525Z\e[0m\e[0m",
70
77
  "",
71
- "\e[37mTesting.\e[0m",
78
+ "\e[37mCUT! What in the hell do you think you're doing here? This is a closed set.\e[0m",
72
79
  "",
73
- " \e[33m/trunk/buildNumber.properties\e[0m"
80
+ "\e[1m \e[32m/src/java\e[0m\e[0m",
81
+ " \e[32m/src/java/Alpha.java\e[0m",
82
+ " \e[32m/src/java/Bravo.java\e[0m"
74
83
  ]
75
- assert_format explines, entries[0], true, 4, true, true, 15
84
+ assert_format explines, true, 3, true, true
76
85
  end
77
86
 
78
- def test_no_colors_from_head_not_from_tail_index_4
87
+ def test_no_colors_from_head_not_from_tail_index_3
79
88
  entries = ENTRIES
80
89
  explines = [
81
- "1950 -5 jpace 2011-12-05T12:41:52.385786Z",
90
+ "16 -4 Buddy Bizarre 2012-09-16T14:07:30.329525Z",
82
91
  "",
83
- "Testing.",
92
+ "CUT! What in the hell do you think you're doing here? This is a closed set.",
84
93
  "",
85
- " /trunk/buildNumber.properties"
94
+ " /src/java",
95
+ " /src/java/Alpha.java",
96
+ " /src/java/Bravo.java"
86
97
  ]
87
- assert_format explines, entries[0], false, 4, true, false, 15
98
+ assert_format explines, false, 3, true, false
88
99
  end
89
100
  end
90
101
  end
@@ -2,7 +2,7 @@
2
2
  # -*- ruby -*-
3
3
 
4
4
  require 'tc'
5
- require 'pvn/subcommands/log/options'
5
+ require 'pvn/log/options'
6
6
  require 'resources'
7
7
 
8
8
  module PVN; module App; module Log; end; end; end
@@ -10,7 +10,7 @@ module PVN; module App; module Log; end; end; end
10
10
  module PVN::App::Log
11
11
  class OptionsTest < PVN::TestCase
12
12
  def assert_options exp, args
13
- options = PVN::Subcommands::Log::OptionSet.new
13
+ options = PVN::Log::OptionSet.new
14
14
  options.process args
15
15
 
16
16
  assert_equal exp[:limit], options.limit
@@ -24,8 +24,8 @@ module PVN::App::Log
24
24
  expdata = Hash.new
25
25
  expdata[:limit] = nil
26
26
  expdata[:revision] = rev
27
- expdata[:path] = Resources::WIQTR_PATH
28
- assert_options expdata, [ arg, Resources::WIQTR_PATH ].flatten
27
+ expdata[:path] = Resources::PT_PATH
28
+ assert_options expdata, [ arg, Resources::PT_PATH ].flatten
29
29
  end
30
30
 
31
31
  def test_default
@@ -0,0 +1,157 @@
1
+ #!/usr/bin/ruby -w
2
+ # -*- ruby -*-
3
+
4
+ require 'tc'
5
+ require 'svnx/log/entries'
6
+ require 'pvn/revision/argument'
7
+
8
+ require 'resources'
9
+
10
+ module PVN::Revision
11
+ class ArgumentTestCase < PVN::TestCase
12
+ def setup
13
+ # This is the equivalent of "log" at revision 22, when this file was added
14
+ # at revision 13. Using this instead of just "log" when regenerating the
15
+ # resource files keeps the revisions from bouncing around.
16
+ @xmllines = Resources::PT_LOG_R22_13_SECONDFILE_TXT.readlines
17
+ end
18
+
19
+ def create_argument value
20
+ Argument.new value, @xmllines
21
+ end
22
+
23
+ def assert_argument_value exp_value, value
24
+ arg = create_argument value
25
+ assert_equal exp_value, arg.value
26
+ end
27
+
28
+ def assert_argument_value_raises value
29
+ assert_raises(PVN::Revision::RevisionError) do
30
+ assert_argument_value nil, value
31
+ end
32
+ end
33
+
34
+ def assert_argument_to_s exp_str, value
35
+ arg = create_argument value
36
+ assert_equal exp_str, arg.to_s
37
+ end
38
+
39
+ def assert_compare op, exp, xval, yval
40
+ x = create_argument xval
41
+ y = create_argument yval
42
+ msg = "xval: #{xval}; yval: #{yval}"
43
+ assert_equal exp, x.send(op, y), msg
44
+ end
45
+
46
+ def assert_argument_eq expeq, xval, yval
47
+ # it's the emoticon programming language
48
+ assert_compare :==, expeq, xval, yval
49
+ end
50
+
51
+ def assert_argument_gt expeq, xval, yval
52
+ assert_compare :>, expeq, xval, yval
53
+ end
54
+
55
+ def test_absolute_midrange
56
+ assert_argument_value 19, 19
57
+ end
58
+
59
+ def test_absolute_most_recent
60
+ assert_argument_value 22, 22
61
+ end
62
+
63
+ def test_absolute_least_recent
64
+ assert_argument_value 13, 13
65
+ end
66
+
67
+ def test_absolute_midrange_as_string
68
+ assert_argument_value 19, '19'
69
+ end
70
+
71
+ def test_absolute_most_recent_as_string
72
+ assert_argument_value 22, '22'
73
+ end
74
+
75
+ def test_absolute_least_recent_as_string
76
+ assert_argument_value 13, '13'
77
+ end
78
+
79
+ def test_svn_word
80
+ %w{ HEAD BASE COMMITTED PREV }.each do |word|
81
+ assert_argument_value word, word
82
+ end
83
+ end
84
+
85
+ def test_negative_most_recent
86
+ assert_argument_value 22, -1
87
+ end
88
+
89
+ def test_negative_second_most_recent
90
+ assert_argument_value 20, -2
91
+ end
92
+
93
+ def test_negative_least_recent
94
+ assert_argument_value 13, -5
95
+ end
96
+
97
+ def test_negative_too_far_back
98
+ assert_argument_value_raises(-6)
99
+ end
100
+
101
+ def test_negative_most_recent_as_string
102
+ assert_argument_value 22, '-1'
103
+ end
104
+
105
+ def test_negative_second_most_recent_as_string
106
+ assert_argument_value 20, '-2'
107
+ end
108
+
109
+ def test_negative_least_recent_as_string
110
+ assert_argument_value 13, '-5'
111
+ end
112
+
113
+ def test_negative_too_far_back_as_string
114
+ assert_argument_value_raises '-6'
115
+ end
116
+
117
+ def test_positive_most_recent
118
+ assert_argument_value 22, '+5'
119
+ end
120
+
121
+ def test_positive_second_most_recent
122
+ assert_argument_value 20, '+4'
123
+ end
124
+
125
+ def test_positive_least_recent
126
+ assert_argument_value 13, '+1'
127
+ end
128
+
129
+ def test_positive_too_far_forward
130
+ assert_argument_value_raises '+6'
131
+ end
132
+
133
+ def xxxtest_range_svn_word_to_number
134
+ assert_argument_value 'BASE:1', 'BASE:1'
135
+ end
136
+
137
+ def xxxtest_date
138
+ assert_argument_to_s '1967-12-10', '1967-12-10'
139
+ end
140
+
141
+ def test_to_s
142
+ assert_argument_to_s '5', '5'
143
+ assert_argument_to_s 'HEAD', 'HEAD'
144
+ end
145
+
146
+ def test_eq
147
+ assert_argument_eq true, '5', '5'
148
+ assert_argument_eq false, '4', '5'
149
+ assert_argument_eq false, '5', '4'
150
+ end
151
+
152
+ def test_gt
153
+ assert_argument_gt true, '17', '16'
154
+ assert_argument_gt false, '13', '14'
155
+ end
156
+ end
157
+ end
@@ -1,9 +1,8 @@
1
1
  #!/usr/bin/ruby -w
2
2
  # -*- ruby -*-
3
3
 
4
- require 'tc'
5
- require 'pvn/subcommands/revision/multiple_revisions_option'
6
- require 'pvn/subcommands/revision/tc'
4
+ require 'pvn/revision/tc'
5
+ require 'pvn/revision/multiple_revisions_option'
7
6
 
8
7
  module PVN
9
8
  class MockMultipleRevisionsRegexpOption < MultipleRevisionsRegexpOption
@@ -22,19 +21,19 @@ module PVN
22
21
  end
23
22
 
24
23
  def test_out_of_range
25
- assert_revision_option_raises '-164'
24
+ assert_revision_option_raises '-20'
26
25
  end
27
26
 
28
27
  def test_post_process_single_middling
29
- assert_post_process [ '1887' ], [ '-7' ]
28
+ assert_post_process [ '13' ], [ '-7' ]
30
29
  end
31
30
 
32
31
  def test_post_process_single_latest
33
- assert_post_process [ '1950' ], '-1'
32
+ assert_post_process [ '19' ], '-1'
34
33
  end
35
34
 
36
35
  def test_post_process_single_oldest
37
- assert_post_process [ '412' ], '-163'
36
+ assert_post_process [ '1' ], '-19'
38
37
  end
39
38
 
40
39
  def test_post_process_single_tagval_unconverted
@@ -42,19 +41,19 @@ module PVN
42
41
  end
43
42
 
44
43
  def test_post_process_single_tagrange_unconverted
45
- assert_post_process [ '7:177' ], '-r7:177'
44
+ assert_post_process [ '7:17' ], '-r7:17'
46
45
  end
47
46
 
48
47
  def test_post_process_multiple_middling
49
- assert_post_process [ '1887', '1950' ], [ '-7', '-1' ]
48
+ assert_post_process [ '13', '19' ], [ '-7', '-1' ]
50
49
  end
51
50
 
52
51
  def test_post_process_multiple_relative_tagval_unconverted
53
- assert_post_process [ '1944', '7' ], [ '-5', '-r7' ]
52
+ assert_post_process [ '15', '7' ], [ '-5', '-r7' ]
54
53
  end
55
54
 
56
55
  def test_process_tag_value
57
- assert_process %w{ 317 }, %w{ -r 317 }
56
+ assert_process %w{ 17 }, %w{ -r 17 }
58
57
  end
59
58
  end
60
59
  end
@@ -0,0 +1,26 @@
1
+ #!/usr/bin/ruby -w
2
+ # -*- ruby -*-
3
+
4
+ require 'tc'
5
+ require 'svnx/log/entries'
6
+ require 'pvn/revision/range'
7
+
8
+ require 'resources'
9
+
10
+ module PVN::Revision
11
+ class RangeTestCase < PVN::TestCase
12
+ def test_init
13
+ rr = Range.new '143:199'
14
+ assert_equal '143', rr.from.to_s
15
+ assert_equal '199', rr.to.to_s
16
+ assert_equal '143:199', rr.to_s
17
+ end
18
+
19
+ def test_to_working_copy
20
+ rr = Range.new '143'
21
+ assert_equal '143', rr.from.to_s
22
+ assert_nil rr.to
23
+ assert_equal '143', rr.to_s
24
+ end
25
+ end
26
+ end
@@ -1,10 +1,8 @@
1
1
  #!/usr/bin/ruby -w
2
2
  # -*- ruby -*-
3
3
 
4
- require 'tc'
5
- require 'pvn/subcommands/revision/revision_option'
6
- require 'pvn/subcommands/revision/tc'
7
- require 'resources'
4
+ require 'pvn/revision/tc'
5
+ require 'pvn/revision/revision_option'
8
6
 
9
7
  module PVN
10
8
  class MockRevisionOption < RevisionOption
@@ -20,45 +18,42 @@ module PVN
20
18
  opt.set_value val
21
19
  end
22
20
 
23
- def assert_relative_to_absolute exp, val
21
+ def assert_relative_to_absolute exp, val, path = Resources::PT_PATH
24
22
  ropt = MockRevisionOption.new
25
- act = ropt.relative_to_absolute val, Resources::WIQTR_PATH
26
- info "act: #{act}".cyan
27
- assert_equal exp, act, "val: #{val}; path: #{val}"
23
+ act = ropt.relative_to_absolute val, path
24
+ assert_equal exp, act, "val: #{val}; path: #{path}"
28
25
  end
29
26
 
30
27
  def test_relative_to_absolute_middling
31
- assert_relative_to_absolute '1887', '-7'
28
+ assert_relative_to_absolute '13', '-7'
32
29
  end
33
30
 
34
31
  def test_relative_to_absolute_latest
35
- assert_relative_to_absolute '1950', '-1'
32
+ assert_relative_to_absolute '19', '-1'
36
33
  end
37
34
 
38
35
  def test_relative_to_absolute_oldest
39
- assert_relative_to_absolute '412', '-163'
36
+ assert_relative_to_absolute '1', '-19'
40
37
  end
41
38
 
42
39
  def test_out_of_range
43
- assert_raises(PVN::Revision::RevisionError) do
44
- assert_relative_to_absolute '1944', '-164'
45
- end
40
+ assert_revision_option_raises '-20'
46
41
  end
47
42
 
48
43
  def test_post_process_absolute_middling
49
- assert_post_process '1887', '1887'
44
+ assert_post_process '13', '13'
50
45
  end
51
46
 
52
47
  def test_post_process_middling
53
- assert_post_process '1887', '-7'
48
+ assert_post_process '13', '-7'
54
49
  end
55
50
 
56
51
  def test_post_process_latest
57
- assert_post_process '1950', '-1'
52
+ assert_post_process '19', '-1'
58
53
  end
59
54
 
60
55
  def test_post_process_oldest
61
- assert_post_process '412', '-163'
56
+ assert_post_process '1', '-19'
62
57
  end
63
58
  end
64
59
  end