about summary refs log tree commit homepage
path: root/test/test_tracklist.rb
diff options
authorEric Wong <e@80x24.org>2015-12-07 09:50:26 +0000
committerEric Wong <e@80x24.org>2015-12-07 09:50:26 +0000
commitb08fe09e296524daf4de7ed16e0bed224f5008a2 (patch)
treec349b14b6e72f168469e3a8a732099d5bd5d681a /test/test_tracklist.rb
parent3e013d3f24f0f935dce985d4c6bd155889e05dbb (diff)
This defaults to 16384?  This is what mpd uses by default as well.
Of course folks interacting with dtas-player directly can override

	dtas-tl max INTEGER
	dtas-tl max

This is NOT meant to be a hard security measure for local users
talking to dtas-player directly.  It is only to prevent
accidentally stupid things like flooding the playlist with
a broken script and to prevent remote users from DoS-ing
us via the to-be-written mpd proxy/emulation layer.

Remember: dtas-player itself will ALWAYS remain capable of
executing arbitrary code :)
Diffstat (limited to 'test/test_tracklist.rb')
1 files changed, 12 insertions, 0 deletions
diff --git a/test/test_tracklist.rb b/test/test_tracklist.rb
index a3c89f6..4d00227 100644
--- a/test/test_tracklist.rb
+++ b/test/test_tracklist.rb
@@ -106,4 +106,16 @@ class TestTracklist < Testcase
     tl.remove_track(1 << 128)
     assert_equal %w(b c e f), list_to_path(tl), "no change"
+  def test_max
+    tl = DTAS::Tracklist.new
+    assert_kind_of Integer, tl.add_track('z')
+    assert_kind_of Integer, tl.max
+    tl.max = 1
+    assert_equal false, tl.add_track('y')
+    assert_equal 1, tl.instance_variable_get(:@list).size
+    tl.max = 2
+    assert_kind_of Integer, tl.add_track('y')
+    assert_equal 2, tl.instance_variable_get(:@list).size
+  end