1
by brian
clean slate |
1 |
#### include/show_msg80.inc |
2 |
#
|
|
3 |
# This file writes the value set in @message into the a protocol file as part |
|
4 |
# of executing a test sequence with a dash line that is fixed on 80 characters. |
|
5 |
#
|
|
6 |
# This can be used in the case of long messages, multi line messages that |
|
7 |
# exceed 80 or if an 80 char line is desired for short messages. |
|
8 |
#
|
|
9 |
# Usage: |
|
10 |
# Add the following to any *.test file: |
|
11 |
# : |
|
12 |
# let $message= <value>; |
|
13 |
# --source include/show_msg80.inc |
|
14 |
# : |
|
15 |
#
|
|
16 |
# Attention: |
|
17 |
# - Please do not write any spaces between $message and the "=", because the |
|
18 |
# assignment will not work. |
|
19 |
# - Be careful with single quotes within the value. They must be escaped like |
|
20 |
# "''" or "\'". |
|
21 |
# - Do not keep the value between single quotes. |
|
22 |
#
|
|
23 |
#
|
|
24 |
# Content of "$message" and protocol output depending on the assignment: |
|
25 |
# ---------------------------------------------------------------------- |
|
26 |
#
|
|
27 |
# I is assumed, that the value is not kept between double quotes. |
|
28 |
#
|
|
29 |
# <x> first character after "$message=", |
|
30 |
# where the content is not (space or tab) |
|
31 |
# <y*> first character after beginning of the line, |
|
32 |
# where the content is not (space or tab) |
|
33 |
# <z> last char before ";" |
|
34 |
# | beginning or end of line |
|
35 |
#
|
|
36 |
# script: let $message= <x><whatever0>| |
|
37 |
# | <y1><whatever1>| |
|
38 |
# |................| |
|
39 |
# | <yn><whatevern><z>; |
|
40 |
# content: "<x><whatever0><new line><y1><whatever1><new line> |
|
41 |
# ....<new line><yn><whatevern><z>"
|
|
42 |
# protocol output: |<x><whatever0>| |
|
43 |
# |<y1><whatever1>| |
|
44 |
# |.....| |
|
45 |
# |<yn><whatevern><z>| |
|
46 |
# |--- 80 dashes ---| |
|
47 |
#
|
|
48 |
# Attention: |
|
49 |
# <x> and <y*> set to characters like "-$#" which are also used |
|
50 |
# to start comments, options and the names of mysqltest variables |
|
51 |
# lead to syntax errors or mangled messages. |
|
52 |
#
|
|
53 |
#
|
|
54 |
# Examples of messages: |
|
55 |
# --------------------- |
|
56 |
#
|
|
57 |
# Variant1 (ease of use): |
|
58 |
# Several lines with indentation kept between double quotes |
|
59 |
# script: |let $message= |
|
60 |
# |" Testcase 3.1 : Ensure that Pi is not an| |
|
61 |
# | integer number.|
|
|
62 |
# | Third line"; |
|
63 |
# protocol: |" Testcase 3.1 : Ensure that Pi is not an| |
|
64 |
# | integer number.|
|
|
65 |
# | Third line"| |
|
66 |
# |------ 80 dashes ----| |
|
67 |
#
|
|
68 |
# Please mention that |
|
69 |
# - the '"' preserves the indentation. |
|
70 |
# - it is easy to write the script lines to get a fine indentation,
|
|
71 |
# if the value starts at the beginning of a new line
|
|
72 |
# - the '"' is printed |
|
73 |
# - there are the least or no problems with characters like "-#$" |
|
74 |
#
|
|
75 |
#
|
|
76 |
# Variant 2 (grep the messages from the protocol is easy): |
|
77 |
# Several lines with indentation + auxiliary character (".") |
|
78 |
# at the (non tab or space) beginning of every message line |
|
79 |
# script: |let $message= . Testcase 3.1 : Ensure that Pi is not an| |
|
80 |
# | . integer number.| |
|
81 |
# | . Third line; |
|
82 |
# protocol: |. Testcase 3.1 : Ensure that Pi is not an| |
|
83 |
# |. integer number.| |
|
84 |
# |. Third line| |
|
85 |
# |------ 80 dashes ----| |
|
86 |
# Please mention that |
|
87 |
# - the auxiliary character preserves the indentation. |
|
88 |
# - it is easy to write the script lines to get a fine indentation |
|
89 |
# - the auxiliary character is printed |
|
90 |
# - it is recommended to use "." as auxiliary character |
|
91 |
# - auxiliary characters like "-'$#" cause problems |
|
92 |
#
|
|
93 |
#
|
|
94 |
#
|
|
95 |
# Bad variant1: Several lines with lost indentation |
|
96 |
# script: |let $message= Here is message line 1 |
|
97 |
# | message line 2; |
|
98 |
# protocol: |Here is message line 1| |
|
99 |
# |message line 2| |
|
100 |
# |------ 80 dashes ----| |
|
101 |
# Please mention, that the leading spaces of the message lines disappeared. |
|
102 |
#
|
|
103 |
# Bad variant2: Several lines leading to a syntax error, because of "-" |
|
104 |
# script: |let $message= - This is a message |
|
105 |
# | - with a second and |
|
106 |
# | - third line; |
|
107 |
# protocol: | - third line;; |
|
108 |
# |ERROR 42000: You have an error ... near '- third line' |
|
109 |
# + several following errors |
|
110 |
#
|
|
111 |
#
|
|
112 |
||
113 |
--disable_query_log |
|
114 |
eval SET @utf8_message = CONVERT('$message' using utf8); |
|
115 |
select @utf8_message as "" |
|
116 |
union
|
|
117 |
select repeat(CONVERT('-' using utf8),80); |
|
118 |
--enable_query_log |