rbibtex 0.0.2 → 0.1.0

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.
@@ -0,0 +1,88 @@
1
+ #!/usr/bin/ruby
2
+
3
+ $:.unshift "../lib"
4
+
5
+ require "test/unit"
6
+ require "rbibtex/string"
7
+
8
+ class StringTest < Test::Unit::TestCase
9
+ def test_unwrap
10
+ assert_equal("this is a paragraph\n\nand this is another", "this is\na paragraph\n\nand this is another".unwrap)
11
+ assert_equal("a b", "\n\na\nb\n\n".unwrap)
12
+ assert_equal("a b c\n\nd e f", "a b c\n\nd e f".unwrap)
13
+ end
14
+
15
+ def test_deindent
16
+ assert_equal("this\n \is\n indented\n hangingly\n", "this\n \is\n indented\n hangingly\n".deindent)
17
+ assert_equal("this\n\is\nindented\nhangingly\n", "this\n \is\n indented\n hangingly\n".deindent(2))
18
+ assert_equal("this\n\is\nindented\n more\n", " this\n \is\n indented\n more\n".deindent)
19
+ assert_equal(" this\n\ is\n indented\n more\n", " this\n \is\n indented\n more\n".deindent(1))
20
+ end
21
+
22
+ def test_deindent_hanging
23
+ assert_equal("this\n\is\nindented\nhangingly\n", "this\n \is\n indented\n hangingly\n".deindent_hanging)
24
+ assert_equal("this\n\is\nindented\nhangingly\n", "this\n \is\n indented\n hangingly\n".deindent_hanging(2))
25
+ assert_equal("this\n\is\nindented\n more", " this\n \is\n indented\n more".deindent_hanging)
26
+ assert_equal(" this\n\ is\n indented\n more\n", " this\n \is\n indented\n more\n".deindent_hanging(1))
27
+ assert_equal("\nx\n y\nz\n", "\n x\n y\n z\n".deindent_hanging)
28
+ end
29
+
30
+ def test_untabify
31
+ assert_equal("", "".untabify)
32
+ assert_equal(" "*8, "\t".untabify)
33
+ assert_equal(" "*8 + " ", "\t ".untabify)
34
+ assert_equal(" \n ", "\t\n\t".untabify(2))
35
+ end
36
+
37
+ def test_indent
38
+ assert_equal(" a\n b", "a\nb".indent(2))
39
+ assert_equal(" a\n b\n", "a\nb\n".indent(2))
40
+ assert_equal(" \n a\n b\n", "\na\nb\n".indent(2))
41
+ assert_equal(" a\n b\n c", "a\n b\nc".indent(2))
42
+ end
43
+
44
+ def test_indent_hanging
45
+ assert_equal("", "".indent_hanging(2))
46
+ assert_equal("a", "a".indent_hanging(2))
47
+ assert_equal("a\n b", "a\nb".indent_hanging(2))
48
+ assert_equal("a\n b\n", "a\nb\n".indent_hanging(2))
49
+ assert_equal("\n a\n b\n", "\na\nb\n".indent_hanging(2))
50
+ assert_equal("a\n b\n c", "a\n b\nc".indent_hanging(2))
51
+ end
52
+
53
+
54
+ def test_wrap
55
+ lorem78 = "Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Vivamus urna. Donec
56
+ tristique gravida nisi. Curabitur porttitor. Pellentesque habitant morbi
57
+ tristique senectus et netus et malesuada fames ac turpis egestas. Fusce vel
58
+ arcu. Suspendisse dapibus est elementum velit. Duis consectetuer, tellus ut
59
+ adipiscing facilisis, odio nibh imperdiet urna, non gravida odio."
60
+ lorem20 = "Lorem ipsum dolor
61
+ sit amet,
62
+ consectetuer
63
+ adipiscing elit.
64
+ Vivamus urna. Donec
65
+ tristique gravida
66
+ nisi. Curabitur
67
+ porttitor.
68
+ Pellentesque
69
+ habitant morbi
70
+ tristique senectus
71
+ et netus et
72
+ malesuada fames ac
73
+ turpis egestas.
74
+ Fusce vel arcu.
75
+ Suspendisse dapibus
76
+ est elementum velit.
77
+ Duis consectetuer,
78
+ tellus ut adipiscing
79
+ facilisis, odio nibh
80
+ imperdiet urna, non
81
+ gravida odio."
82
+
83
+ lorem = lorem78.gsub("\n", " ")
84
+ assert_equal(lorem78, lorem.wrap(78))
85
+ assert_equal(lorem20, lorem.wrap(20))
86
+ assert_equal("a"*20, ("a"*20).wrap(10))
87
+ end
88
+ end
metadata CHANGED
@@ -3,8 +3,8 @@ rubygems_version: 0.8.11
3
3
  specification_version: 1
4
4
  name: rbibtex
5
5
  version: !ruby/object:Gem::Version
6
- version: 0.0.2
7
- date: 2005-11-09 00:00:00 +01:00
6
+ version: 0.1.0
7
+ date: 2005-11-14 00:00:00 +01:00
8
8
  summary: A bibtex parsing library written in pure ruby
9
9
  require_paths:
10
10
  - lib
@@ -39,21 +39,30 @@ authors:
39
39
  files:
40
40
  - papers.bib
41
41
  - README
42
- - test.bib
43
42
  - CHANGELOG
44
43
  - InstalledFiles
45
44
  - papers.html
45
+ - papers.new.bib
46
46
  - setup.rb
47
47
  - bin
48
48
  - lib
49
+ - test
49
50
  - bin/rbib2html
50
51
  - bin/rbib2bib
51
52
  - bin/rbib2txt
52
53
  - lib/rbibtex.rb
53
54
  - lib/rbibtex
54
55
  - lib/rbibtex/pre-setup.rb
56
+ - lib/rbibtex/string.rb
57
+ - lib/rbibtex/types.rb
55
58
  - lib/rbibtex/rbibtex.y
56
- test_files: []
59
+ - lib/rbibtex/transform.rb
60
+ - test/test_string.rb
61
+ - test/test.bib
62
+ - test/test_bib.rb
63
+ test_files:
64
+ - test/test_string.rb
65
+ - test/test_bib.rb
57
66
  rdoc_options: []
58
67
  extra_rdoc_files: []
59
68
  executables:
data/test.bib DELETED
@@ -1,5 +0,0 @@
1
- @comment {
2
- todo:
3
- pdf = {local/blake_sparse_realtime_tracking.pdf}
4
- x
5
- }