File: sublet.rb

package info (click to toggle)
subtle 0.11.3224-xi-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 1,600 kB
  • sloc: ansic: 14,699; ruby: 3,101; makefile: 17
file content (72 lines) | stat: -rw-r--r-- 1,692 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
#
# @package test
#
# @file Test Subtlext::Sublet functions
# @author Christoph Kappel <unexist@subforge.org>
# @version $Id: test/contexts/sublet.rb,v 3171 2012/01/03 20:53:09 unexist $
#
# This program can be distributed under the terms of the GNU GPLv2.
# See the file COPYING for details.
#

context 'Sublet' do
  SUBLET_COUNT = 1
  SUBLET_ID    = 0
  SUBLET_NAME  = 'dummy'

  setup do # {{{
    Subtlext::Sublet.first(SUBLET_ID)
  end # }}}

  asserts 'Check attributes' do # {{{
    SUBLET_ID == topic.id and SUBLET_NAME == topic.name
  end # }}}

  asserts 'Get list' do # {{{
    list = Subtlext::Sublet.list

    list.is_a?(Array) and SUBLET_COUNT == list.size and
      Subtlext::Sublet.method(:all) == Subtlext::Sublet.method(:list)
  end # }}}

  asserts 'Finder' do # {{{
    index  = Subtlext::Sublet[SUBLET_ID]
    string = Subtlext::Sublet[SUBLET_NAME]
    sym    = Subtlext::Sublet[SUBLET_NAME.to_sym]
    all    = Subtlext::Sublet.find('.*')
    none   = Subtlext::Sublet['abcdef']

    index == string and index == sym and none.nil?
  end # }}}

  asserts 'First' do # {{{
    index  = Subtlext::Sublet.first(SUBLET_ID)
    string = Subtlext::Sublet.first(SUBLET_NAME)

    index == string
  end # }}}

  asserts 'Update sublet' do # {{{
    topic.update

    true
  end # }}}

  asserts 'Get geometry' do # {{{
    topic.geometry.is_a?(Subtlext::Geometry)
  end # }}}

  asserts 'Equal and compare' do # {{{
    topic.eql?(topic) and topic == topic
  end # }}}

  asserts 'Hash and unique' do # {{{
    1 == [ topic, topic ].uniq.size
  end # }}}

  asserts 'Convert to string' do # {{{
    SUBLET_NAME == topic.to_str
  end # }}}
end

# vim:ts=2:bs=2:sw=2:et:fdm=marker