From 11b3750c9115792fcbf0617e04a841bbc4841912 Mon Sep 17 00:00:00 2001 From: Daniel Kolesa Date: Sun, 26 May 2019 18:24:40 +0200 Subject: [PATCH] eolian: add test for file versioning --- src/tests/eolian/data/class_simple.eo | 2 ++ src/tests/eolian/eolian_parsing.c | 17 +++++++++++++++++ 2 files changed, 19 insertions(+) diff --git a/src/tests/eolian/data/class_simple.eo b/src/tests/eolian/data/class_simple.eo index c6aa05b..8717145 100644 --- a/src/tests/eolian/data/class_simple.eo +++ b/src/tests/eolian/data/class_simple.eo @@ -1,3 +1,5 @@ +#version 1 + const Foo: int = 5; [[doc for constant]] var Bar: float = 10.3f; [[doc for global]] diff --git a/src/tests/eolian/eolian_parsing.c b/src/tests/eolian/eolian_parsing.c index 2fbb1b5..c8f4383 100644 --- a/src/tests/eolian/eolian_parsing.c +++ b/src/tests/eolian/eolian_parsing.c @@ -1587,6 +1587,22 @@ EFL_START_TEST(eolian_class_unimpl) } EFL_END_TEST +EFL_START_TEST(eolian_version) +{ + Eolian_State *eos = eolian_state_new(); + const Eolian_Unit *u1, *u2; + + fail_if(!eolian_state_directory_add(eos, TESTS_SRC_DIR"/data")); + + fail_if(!(u1 = eolian_state_file_parse(eos, "class_simple.eo"))); + fail_if(!(u2 = eolian_state_file_parse(eos, "base.eo"))); + fail_if(eolian_unit_version_get(u1) != 1); + fail_if(eolian_unit_version_get(u2) != 1); + + eolian_state_free(eos); +} +EFL_END_TEST + void eolian_parsing_test(TCase *tc) { tcase_add_test(tc, eolian_simple_parsing); @@ -1612,4 +1628,5 @@ void eolian_parsing_test(TCase *tc) tcase_add_test(tc, eolian_mixins_require); tcase_add_test(tc, eolian_class_requires_classes); tcase_add_test(tc, eolian_class_unimpl); + tcase_add_test(tc, eolian_version); } -- 2.7.4