forked from Manfred/Ensure-encoding
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
37 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
Le botier tanche permet de le mettre en �uvre dans les conditions les plus extrmes. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
# encoding: utf-8 | ||
|
||
require File.expand_path('../../start', __FILE__) | ||
|
||
describe "Ensure::Encoding, concerning cleanup of garbled input" do | ||
it "should be allowed to throw errors when not forced to drop invalid characters" do | ||
Dir.glob(File.expand_path('../../examples', __FILE__) + '/garbled*').each do |filename| | ||
text = read_example(filename) | ||
lambda { | ||
Ensure::Encoding.force_encoding(text, 'UTF-8') | ||
}.should.raise(Encoding::UndefinedConversionError) | ||
end | ||
end | ||
|
||
it "should not throw errors when forced to drop invalid characters" do | ||
Dir.glob(File.expand_path('../../examples', __FILE__) + '/garbled*').each do |filename| | ||
text = read_example(filename) | ||
lambda { | ||
Ensure::Encoding.force_encoding(text, 'UTF-8', :invalid_characters => :drop) | ||
}.should.not.raise | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters