소스 검색

Refactor ffoo_import test inc. docstrings

...so that it can be understood by future reader.
Alois Mahdal 10 년 전
부모
커밋
875fd46b01
1개의 변경된 파일25개의 추가작업 그리고 11개의 파일을 삭제
  1. 25
    11
      test/tests/ffoo_import/TF_RUN

+ 25
- 11
test/tests/ffoo_import/TF_RUN 파일 보기

33
     echo FFOO_VERSION
33
     echo FFOO_VERSION
34
 }
34
 }
35
 
35
 
36
-print_listing_code() {
36
+mksnippet() {
37
     #
37
     #
38
-    # Print the code that stores the listing we need to compare
38
+    # Produce a snippet to store env info to a file $1
39
     #
39
     #
40
-    # This will be included into the mini-test.
40
+    # File _ignored_ is used as list of tokens to always
41
+    # remove from the info.
41
     #
42
     #
42
     local target=$1
43
     local target=$1
43
     printf "
44
     printf "
50
         " $target
51
         " $target
51
 }
52
 }
52
 
53
 
53
-assemble_test_script() {
54
+wrap_test() {
54
     #
55
     #
55
-    # Assemble test script from listing code and import code
56
+    # Assemble and print test script code
56
     #
57
     #
57
-    # Assemble test script by including listing code, importing
58
-    # code and listing code again.  Final script should generate
59
-    # $1.before and $2.after
58
+    # Assemble test script by including scanning snippet,
59
+    # importing code from file $1, and snippet again.  If run,
60
+    # the code printed by this function will generate two
61
+    # files: $1.before and $1.after.
60
     #
62
     #
61
     local name=$1
63
     local name=$1
62
-    print_listing_code $name.before
64
+    mksnippet $name.before
63
     cat "$name" \
65
     cat "$name" \
64
       | sed -e "s|\\<ffoom\\>|$ffoom_path|"   # << since PATH may be empty
66
       | sed -e "s|\\<ffoom\\>|$ffoom_path|"   # << since PATH may be empty
65
-    print_listing_code $name.after
67
+    mksnippet $name.after
66
 }
68
 }
67
 
69
 
68
 tf_do_subtest() {
70
 tf_do_subtest() {
71
+    #
72
+    # Prepare, run and check results of test $1
73
+    #
74
+    # Contents of $1 file (which is supposed to be importing
75
+    # code) are altered for testing and wrapped so that on
76
+    # execution in clean environment, two files are produced to
77
+    # hold sets of detected variable and function names--before
78
+    # import and after it.
79
+    #
80
+    # The difference of the sets (i.e. what we have *really*
81
+    # imported) must be same as $1.oracle.
82
+    #
69
     local name=$1
83
     local name=$1
70
-    assemble_test_script $name > $name.sh
84
+    wrap_test $name > $name.sh
71
     env -i bash $name.sh
85
     env -i bash $name.sh
72
     comm -13 $name.before $name.after > $name.new
86
     comm -13 $name.before $name.after > $name.new
73
     # i.e. lines introduced by import ^^
87
     # i.e. lines introduced by import ^^