From 62abac62e02eecb87ce374b82bf042f558d7b13b Mon Sep 17 00:00:00 2001 From: Alex Kotov Date: Tue, 24 May 2022 21:02:46 +0300 Subject: [PATCH] Common: move files with tests for printf --- Makefile.am | 6 +++--- {tests => common}/printf.yml | 0 {tests => common}/printf_orig.yml | 0 pkgs/ruby/spec/lib/kernaux/sprintf_spec.rb | 2 +- tests/printf_gen.py | 9 ++++++--- 5 files changed, 10 insertions(+), 7 deletions(-) rename {tests => common}/printf.yml (100%) rename {tests => common}/printf_orig.yml (100%) diff --git a/Makefile.am b/Makefile.am index f5a00fd..25d517a 100644 --- a/Makefile.am +++ b/Makefile.am @@ -272,12 +272,12 @@ tests_test_printf_gen_SOURCES = \ tests/test_printf_gen.c \ tests/printf_gen.py \ tests/printf_gen.jinja \ - tests/printf.yml \ - tests/printf_orig.yml + common/printf.yml \ + common/printf_orig.yml tests_test_units_human_SOURCES = \ $(libkernaux_a_SOURCES) \ tests/test_units_human.c -tests/test_printf_gen.c: tests/printf_gen.py tests/printf_gen.jinja tests/printf.yml tests/printf_orig.yml +tests/test_printf_gen.c: tests/printf_gen.py tests/printf_gen.jinja common/printf.yml common/printf_orig.yml python3 tests/printf_gen.py diff --git a/tests/printf.yml b/common/printf.yml similarity index 100% rename from tests/printf.yml rename to common/printf.yml diff --git a/tests/printf_orig.yml b/common/printf_orig.yml similarity index 100% rename from tests/printf_orig.yml rename to common/printf_orig.yml diff --git a/pkgs/ruby/spec/lib/kernaux/sprintf_spec.rb b/pkgs/ruby/spec/lib/kernaux/sprintf_spec.rb index 6609100..34b9927 100644 --- a/pkgs/ruby/spec/lib/kernaux/sprintf_spec.rb +++ b/pkgs/ruby/spec/lib/kernaux/sprintf_spec.rb @@ -22,7 +22,7 @@ RSpec.describe KernAux, '.sprintf' do ].each do |(suffix, description)| context description do printf_yml = - File.expand_path("../../../../../tests/printf#{suffix}.yml", __dir__) + File.expand_path("../../../../../common/printf#{suffix}.yml", __dir__) YAML.safe_load_file(printf_yml).each do |test| expected = test['result'] diff --git a/tests/printf_gen.py b/tests/printf_gen.py index 7c8943f..343e792 100644 --- a/tests/printf_gen.py +++ b/tests/printf_gen.py @@ -7,10 +7,13 @@ CASES_REG_FILENAME = 'printf.yml' TEMPLATE_FILENAME = 'printf_gen.jinja' TEST_FILENAME = 'test_printf_gen.c' -TESTS_DIRPATH = path.dirname(path.abspath(__file__)) +ROOT_DIRPATH = path.dirname(path.dirname(path.join(path.abspath(__file__)))) -CASES_ORIG_FILEPATH = path.join(TESTS_DIRPATH, CASES_ORIG_FILENAME) -CASES_REG_FILEPATH = path.join(TESTS_DIRPATH, CASES_REG_FILENAME) +COMMON_DIRPATH = path.join(ROOT_DIRPATH, 'common') +TESTS_DIRPATH = path.join(ROOT_DIRPATH, 'tests') + +CASES_ORIG_FILEPATH = path.join(COMMON_DIRPATH, CASES_ORIG_FILENAME) +CASES_REG_FILEPATH = path.join(COMMON_DIRPATH, CASES_REG_FILENAME) TEST_FILEPATH = path.join(TESTS_DIRPATH, TEST_FILENAME) def main():