[DRE-commits] [ruby-org] 262/303: Add unit test for angle link in regexp helper
Jérémy Bobbio
lunar at alioth.debian.org
Fri Aug 9 17:34:09 UTC 2013
This is an automated email from the git hooks/post-receive script.
lunar pushed a commit to branch master
in repository ruby-org.
commit 7de43a5cabd3fec53b5ceb98e06979133e2fa3a0
Author: Waldemar Quevedo <waldemar.quevedo at gmail.com>
Date: Sun Feb 3 18:51:40 2013 +0900
Add unit test for angle link in regexp helper
---
lib/org-ruby/regexp_helper.rb | 2 ++
spec/regexp_helper_spec.rb | 10 ++++++++--
2 files changed, 10 insertions(+), 2 deletions(-)
diff --git a/lib/org-ruby/regexp_helper.rb b/lib/org-ruby/regexp_helper.rb
index 12f6709..a823f59 100644
--- a/lib/org-ruby/regexp_helper.rb
+++ b/lib/org-ruby/regexp_helper.rb
@@ -158,6 +158,8 @@ module Orgmode
str.gsub! @org_angle_link_text_regexp do |match|
yield $2, nil
end
+
+ str # for testing
end
# Rewrites all of the inline image tags.
diff --git a/spec/regexp_helper_spec.rb b/spec/regexp_helper_spec.rb
index e3d1933..a06d087 100644
--- a/spec/regexp_helper_spec.rb
+++ b/spec/regexp_helper_spec.rb
@@ -38,12 +38,14 @@ describe Orgmode::RegexpHelper do
map = {
"*" => "strong",
"/" => "i",
- "~" => "pre"
+ "~" => "code"
}
n = e.rewrite_emphasis("This string contains *bold*, /italic/, and ~verbatim~ text.") do |border, str|
"<#{map[border]}>#{str}</#{map[border]}>"
end
- n.should eql("This string contains <strong>bold</strong>, <i>italic</i>, and <pre>verbatim</pre> text.")
+ n = e.restore_code_snippets n
+
+ n.should eql("This string contains <strong>bold</strong>, <i>italic</i>, and <code>verbatim</code> text.")
end
it "should allow link rewriting" do
@@ -53,5 +55,9 @@ describe Orgmode::RegexpHelper do
"\"#{text}\":#{link}"
end
str.should eql("\"http://www.bing.com\":http://www.bing.com")
+ str = e.rewrite_links("<http://www.google.com>") do |link|
+ "\"#{link}\":#{link}"
+ end
+ str.should eql("\"http://www.google.com\":http://www.google.com")
end
end # describe Orgmode::RegexpHelper
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-ruby-extras/ruby-org.git
More information about the Pkg-ruby-extras-commits
mailing list