Add tests for filename_language
authorSimon Marchi <simon.marchi@ericsson.com>
Sat, 28 Oct 2017 01:46:49 +0000 (21:46 -0400)
committerSimon Marchi <simon.marchi@ericsson.com>
Sat, 28 Oct 2017 01:46:49 +0000 (21:46 -0400)
commit32fa66eb88d029576cfd8f5698d0579662d2f045
tree728e4349fca5572938db280059832212969a3dba
parentaf5f32f82b0ece140641484d8178ead655f8a0a5
Add tests for filename_language

The next patch touches the filename_language area, but I noticed there
is no test exercising that.  This patch adds some selftests for
add_filename_language, deduce_language_from_filename and
set_ext_lang_command.  Because these tests add entries to the global
filename_language_table vector, it is not possible to run them
successfully multiple times in a same GDB instance.  They can
potentially interfere with each other for the same reason.  I therefore
added the scoped_restore_filename_language_table class that is used to
make sure tests leave that global vector in the same state they found it
(it is replaced in the following patch by a simple scoped_restore).

gdb/ChangeLog:

* symfile.c: Include selftest.h.
(class scoped_restore_filename_language_table): New.
(test_filename_language): New test.
(test_set_ext_lang_command): New test.
(_initialize_symfile): Register tests.
gdb/ChangeLog
gdb/symfile.c