• Publicity: Public Only All

ref-language-procs.tcl

Automated tests for the ref-language package.

Location:
packages/ref-language/tcl/test/ref-language-procs.tcl
Created:
2020-08-21
Author:
Héctor Romojaro
CVS Identification:
$Id: ref-language-procs.tcl,v 1.1.2.1 2020/08/21 15:31:14 hectorr Exp $

Procedures in this file

Detailed information

_ref-language__ref_language__set_data (private)

 _ref-language__ref_language__set_data

Partial Call Graph (max 5 caller/called nodes):
%3 aa_equals aa_equals (public) aa_error aa_error (public) aa_log aa_log (public) aa_log_result aa_log_result (public) aa_run_with_teardown aa_run_with_teardown (public) _ref-language__ref_language__set_data _ref-language__ref_language__set_data _ref-language__ref_language__set_data->aa_equals _ref-language__ref_language__set_data->aa_error _ref-language__ref_language__set_data->aa_log _ref-language__ref_language__set_data->aa_log_result _ref-language__ref_language__set_data->aa_run_with_teardown

Testcases:
No testcase defined.
[ hide source ] | [ make this the default ]

Content File Source

ad_library {
    Automated tests for the ref-language package.

    @author Héctor Romojaro <hector.romojaro@gmail.com>
    @creation-date 2020-08-21
    @cvs-id $Id: ref-language-procs.tcl,v 1.1.2.1 2020/08/21 15:31:14 hectorr Exp $
}

aa_register_case -procs {
        ref_language::set_data
    } -cats {
        api
    } ref_language__set_data {
        Test ref_language::set_data proc.
} {
    aa_run_with_teardown -rollback -test_code {
        #
        # Check if the language foo already exists.
        #
        if {[db_0or1row foo {
            select * from language_639_2_codes where iso_639_2='foo'
        }]} {
            aa_error "Language 'Foo' already exists in the database"
        } else {
            #
            # Create the new language 'foo'.
            #
            # As this is running in a transaction, it should be cleaned up
            # automatically.
            #
            ref_language::set_data -label Foo -iso2 foo
            #
            # Check if creation was successful.
            #
            aa_true "Language Foo created" "[db_0or1row foo {
                select * from language_639_2_codes where iso_639_2='foo'
            }]"
            #
            # Try to modify it
            #
            ref_language::set_data -label Bar -iso2 foo -iso1 fo
            #
            # Check if modification was successful.
            #
            set iso_639_2 ""
            set iso_639_1 ""
            set label ""
            db_0or1row foo {
                select * from language_639_2_codes where iso_639_2='foo'
            }
            aa_equals "iso_639_2 should be foo" "$iso_639_2" "foo"
            aa_equals "iso_639_1 should be foo" "$iso_639_1" "fo"
            aa_equals "label should be Bar"     "$label"     "Bar"
        }
    }
}

# Local variables:
#    mode: tcl
#    tcl-indent-level: 4
#    indent-tabs-mode: nil
# End: