Bugzilla – Attachment 116722 Details for
Bug 22824
Replace YAML::Syck with YAML::XS
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 22824: Add tests
Bug-22824-Add-tests.patch (text/plain), 3.20 KB, created by
Jonathan Druart
on 2021-02-11 14:11:06 UTC
(
hide
)
Description:
Bug 22824: Add tests
Filename:
MIME Type:
Creator:
Jonathan Druart
Created:
2021-02-11 14:11:06 UTC
Size:
3.20 KB
patch
obsolete
>From c1d0f58c0bf5667539df64cf1e32f874d3a89a48 Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Thu, 11 Feb 2021 10:01:02 +0100 >Subject: [PATCH] Bug 22824: Add tests > >Writing some tests to see how things are working currently >--- > t/db_dependent/data/syspref.pref | 29 ++++++++++++ > t/db_dependent/yaml.t | 78 ++++++++++++++++++++++++++++++++ > 2 files changed, 107 insertions(+) > create mode 100644 t/db_dependent/data/syspref.pref > create mode 100755 t/db_dependent/yaml.t > >diff --git a/t/db_dependent/data/syspref.pref b/t/db_dependent/data/syspref.pref >new file mode 100644 >index 0000000000..f72fbd9641 >--- /dev/null >+++ b/t/db_dependent/data/syspref.pref >@@ -0,0 +1,29 @@ >+Test: >+ Testing: >+ - >+ - Do it >+ - pref: syspref_1 >+ choices: >+ on: certainly >+ off: "I don't think so" >+ - >+ - pref: syspref_2 >+ choices: >+ '': Do >+ dont: "Don't do" >+ 0: "really don't do" >+ - it. >+ - >+ - "We love unicode" >+ - pref: syspref_3 >+ choices: >+ â : â¤ï¸ >+ no: "Not really" >+ - >+ - "List of fields" >+ - pref: syspref_4 >+ choices: >+ 020: 020 >+ "020": "020" >+ "123": "123" >+ >diff --git a/t/db_dependent/yaml.t b/t/db_dependent/yaml.t >new file mode 100755 >index 0000000000..177ce18f05 >--- /dev/null >+++ b/t/db_dependent/yaml.t >@@ -0,0 +1,78 @@ >+use Modern::Perl; >+use Test::More; >+ >+use YAML::Syck; >+use Template; >+use utf8; >+ >+$YAML::Syck::ImplicitTyping = 1; >+$YAML::Syck::ImplicitUnicode = 1; >+ >+my $template = Template->new( ENCODING => 'UTF-8' ); >+ >+my $vars; >+my $output; >+$template->process( 't/db_dependent/data/syspref.pref', $vars, \$output ); >+ >+use Data::Printer colored => 1; warn p $output; >+ >+my $yaml = YAML::Syck::Load( $output ); >+my $syspref_1 = $yaml->{Test}->{Testing}->[0]; >+my $syspref_2 = $yaml->{Test}->{Testing}->[1]; >+my $syspref_3 = $yaml->{Test}->{Testing}->[2]; >+my $syspref_4 = $yaml->{Test}->{Testing}->[3]; >+is_deeply( >+ $syspref_1, >+ [ >+ "Do it", >+ { >+ choices => { >+ 1 => "certainly", >+ '' => "I don't think so" >+ }, >+ pref => "syspref_1" >+ } >+ ] >+); >+is_deeply( >+ $syspref_2, >+ [ >+ { >+ choices => { >+ 0 => "really don't do", >+ '' => "Do", >+ dont => "Don't do" >+ }, >+ pref => "syspref_2" >+ }, >+ "it." >+ ] >+); >+is_deeply( >+ $syspref_3, >+ [ >+ "We love unicode", >+ { >+ choices => { >+ '' => "Not really", >+ 'â' => "â¤ï¸" >+ }, >+ pref => "syspref_3" >+ } >+ ], >+); >+is_deeply( >+ $syspref_4, >+ [ >+ "List of fields", >+ { >+ choices => { >+ 16 => 16, >+ "020" => "020", >+ 123 => 123 >+ }, >+ pref => "syspref_4" >+ } >+ ] >+); >+done_testing; >-- >2.20.1
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 22824
:
116722
|
116723
|
116724
|
116725
|
116726
|
116727
|
116728
|
116729
|
116730
|
116731
|
116732
|
116733
|
116734
|
116735
|
116736
|
116741
|
116742
|
116743
|
116744
|
116745
|
116746
|
116747
|
116748
|
116749
|
116750
|
116751
|
116752
|
116753
|
116754
|
116755
|
116756
|
116881
|
116882
|
116883
|
116884
|
117037
|
117039
|
117040
|
117041
|
117042
|
117043
|
117044
|
117045
|
117046
|
117047
|
117048
|
117049
|
117050
|
117051
|
117052
|
117053
|
117054
|
117055
|
117056
|
117057
|
117058
|
117636
|
117637
|
117638
|
117639
|
117640
|
117641
|
117642
|
117643
|
117644
|
117645
|
117646
|
117647
|
117648
|
117649
|
117650
|
117651
|
117652
|
117653
|
117664
|
117666