From 99b75e035927a122f8e2c0fcd93d2950f9d4ed3b Mon Sep 17 00:00:00 2001 From: Bill Erickson Date: Thu, 19 Oct 2017 11:42:43 -0400 Subject: [PATCH] LP#712490 Vandelay replace/merge PGTAP tests Signed-off-by: Bill Erickson Signed-off-by: Jane Sandberg Signed-off-by: Jason Stephenson --- .../sql/Pg/t/lp712490-vand-replace-field-merge.pg | 135 +++++++++++++++++++++ 1 file changed, 135 insertions(+) create mode 100644 Open-ILS/src/sql/Pg/t/lp712490-vand-replace-field-merge.pg diff --git a/Open-ILS/src/sql/Pg/t/lp712490-vand-replace-field-merge.pg b/Open-ILS/src/sql/Pg/t/lp712490-vand-replace-field-merge.pg new file mode 100644 index 0000000000..ca262d8e80 --- /dev/null +++ b/Open-ILS/src/sql/Pg/t/lp712490-vand-replace-field-merge.pg @@ -0,0 +1,135 @@ +BEGIN; + +-- Plan the tests. +SELECT plan(5); + +SELECT is( + (SELECT vandelay.replace_field($$ + + a + + Banks, Iain M + 1954- + + +$$, $$ + + + Banks, Iain M + 1954-2013 + + +$$, '100abcdef')), + ' a Banks, Iain M1954-2013', + 'Replacing a value for a single existing subfield' +); + +SELECT is( + (SELECT vandelay.replace_field($$ + + a + + Banks, Iain M + + +$$, $$ + + + Banks, Iain M + 1954-2013 + + +$$, '100abcdef')), + ' a Banks, Iain M1954-2013', + 'Adding a missing field' +); + +SELECT is( + (SELECT vandelay.replace_field($$ + + a + + Banks, Iain M + 1954- + + +$$, $$ + + + Banks, Iain M + HELLO + 1954-2013 + + +$$, '100abcdef')), + ' a Banks, Iain MHELLO1954-2013', + 'Splicing a new field into the existing fields' +); + +SELECT is( + (SELECT vandelay.replace_field($$ + + a + + Banks, Iain M + 1954- + STAY PUT + + +$$, $$ + + + Banks, Iain M + HELLO + IGNORE ME + 1954-2013 + + +$$, '100abcdef')), + ' a Banks, Iain MHELLO1954-2013STAY PUT', + 'Splice new field, ignore uncontrolled source field, leave uncontrolled target field in place' +); + +SELECT is( + (SELECT vandelay.replace_field($$ + + a + + Banks, Iain M + 1954- + + +$$, $$ + + + Banks, Iain M + + +$$, '100abcdef')), + ' a Banks, Iain M', + 'Removing a subfield' +); + +SELECT * FROM finish(); +ROLLBACK; + -- 2.11.0