~ubuntu-branches/ubuntu/vivid/ruby-stringex/vivid-proposed

« back to all changes in this revision

Viewing changes to test/unit/localization/sv_test.rb

  • Committer: Package Import Robot
  • Author(s): Youhei SASAKI
  • Date: 2014-05-30 01:15:06 UTC
  • mfrom: (1.1.2)
  • Revision ID: package-import@ubuntu.com-20140530011506-gqmvsja16gwyevdv
Tags: 2.5.2-1
* Imported Upstream version 2.5.2
* Drop obsolete patches
* Update test path: follow upstream changes

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
# encoding: UTF-8
 
2
 
 
3
require 'test_helper'
 
4
require 'i18n'
 
5
require 'stringex'
 
6
 
 
7
class SwedishYAMLLocalizationTest < Test::Unit::TestCase
 
8
  def setup
 
9
    Stringex::Localization.reset!
 
10
    Stringex::Localization.backend = :i18n
 
11
    Stringex::Localization.backend.load_translations :sv
 
12
    Stringex::Localization.locale = :sv
 
13
  end
 
14
 
 
15
  {
 
16
    "foo & bar" => "foo och bar",
 
17
    "AT&T" => "AT och T",
 
18
    "99° is normal" => "99 grader is normal",
 
19
    "4 ÷ 2 is 2" => "4 delat med 2 is 2",
 
20
    "webcrawler.com" => "webcrawler punkt com",
 
21
    "Well..." => "Well punkt punkt punkt",
 
22
    "x=1" => "x lika med 1",
 
23
    "a #2 pencil" => "a nummer 2 pencil",
 
24
    "100%" => "100 procent",
 
25
    "cost+tax" => "cost plus tax",
 
26
    "batman/robin fan fiction" => "batman slash robin fan fiction",
 
27
    "dial *69" => "dial stjärna 69",
 
28
    " i leave whitespace on ends unchanged " => " i leave whitespace on ends unchanged "
 
29
  }.each do |original, converted|
 
30
    define_method "test_character_conversion: '#{original}'" do
 
31
      assert_equal converted, original.convert_miscellaneous_characters
 
32
    end
 
33
  end
 
34
 
 
35
  {
 
36
    "¤20" => "20 kronor",
 
37
    "$100" => "100 dollar",
 
38
    "$19.99" => "19 dollar 99 cent",
 
39
    "£100" => "100 pund",
 
40
    "£19.99" => "19 pund 99 pence",
 
41
    "€100" => "100 euro",
 
42
    "€19.99" => "19 euro 99 cent",
 
43
    "¥1000" => "1000 yen"
 
44
  }.each do |original, converted|
 
45
    define_method "test_currency_conversion: '#{original}'" do
 
46
      assert_equal converted, original.convert_miscellaneous_characters
 
47
    end
 
48
  end
 
49
 
 
50
  {
 
51
    "Tea &amp; Sympathy" => "Tea och Sympathy",
 
52
    "10&cent;" => "10 cents",
 
53
    "&copy;2000" => "(c)2000",
 
54
    "98&deg; is fine" => "98 grader is fine",
 
55
    "10&divide;5" => "10 delat med 5",
 
56
    "&quot;quoted&quot;" => '"quoted"',
 
57
    "to be continued&hellip;" => "to be continued...",
 
58
    "2000&ndash;2004" => "2000-2004",
 
59
    "I wish&mdash;oh, never mind" => "I wish--oh, never mind",
 
60
    "&frac12; ounce of gold" => "halv ounce of gold",
 
61
    "1 and &frac14; ounces of silver" => "1 and en fjärdedel ounces of silver",
 
62
    "9 and &frac34; ounces of platinum" => "9 and tre fjärdedelar ounces of platinum",
 
63
    "3&gt;2" => "3>2",
 
64
    "2&lt;3" => "2<3",
 
65
    "two&nbsp;words" => "two words",
 
66
    "&pound;100" => "pund 100",
 
67
    "Walmart&reg;" => "Walmart(r)",
 
68
    "&apos;single quoted&apos;" => "'single quoted'",
 
69
    "2&times;4" => "2x4",
 
70
    "Programming&trade;" => "Programming(tm)",
 
71
    "&yen;20000" => "yen 20000",
 
72
    " i leave whitespace on ends unchanged " => " i leave whitespace on ends unchanged "
 
73
  }.each do |original, converted|
 
74
    define_method "test_html_entity_conversion: '#{original}'" do
 
75
      assert_equal converted, original.convert_miscellaneous_html_entities
 
76
    end
 
77
  end
 
78
 
 
79
  {
 
80
    "&frac12;" => "halv",
 
81
    "½" => "halv",
 
82
    "&#189;" => "halv",
 
83
    "⅓" => "en tredjedel",
 
84
    "&#8531;" => "en tredjedel",
 
85
    "⅔" => "två tredjedelar",
 
86
    "&#8532;" => "två tredjedelar",
 
87
    "&frac14;" => "en fjärdedel",
 
88
    "¼" => "en fjärdedel",
 
89
    "&#188;" => "en fjärdedel",
 
90
    "&frac34;" => "tre fjärdedelar",
 
91
    "¾" => "tre fjärdedelar",
 
92
    "&#190;" => "tre fjärdedelar",
 
93
    "⅕" => "en femtedel",
 
94
    "&#8533;" => "en femtedel",
 
95
    "⅖" => "två femtedelar",
 
96
    "&#8534;" => "två femtedelar",
 
97
    "⅗" => "tre femtedelar",
 
98
    "&#8535;" => "tre femtedelar",
 
99
    "⅘" => "fyra femtedelar",
 
100
    "&#8536;" => "fyra femtedelar",
 
101
    "⅙" => "en sjättedel",
 
102
    "&#8537;" => "en sjättedel",
 
103
    "⅚" => "fem sjättedelar",
 
104
    "&#8538;" => "fem sjättedelar",
 
105
    "⅛" => "en åttondel",
 
106
    "&#8539;" => "en åttondel",
 
107
    "⅜" => "tre åttondelar",
 
108
    "&#8540;" => "tre åttondelar",
 
109
    "⅝" => "fem åttondelar",
 
110
    "&#8541;" => "fem åttondelar",
 
111
    "⅞" => "sju åttondelar",
 
112
    "&#8542;" => "sju åttondelar"
 
113
  }.each do |original, converted|
 
114
    define_method "test_vulgar_fractions_conversion: #{original}" do
 
115
      assert_equal converted, original.convert_vulgar_fractions
 
116
    end
 
117
  end
 
118
end