summaryrefslogtreecommitdiff
path: root/plugin/business/pangu-http/src/test_pattern_replace.cpp
diff options
context:
space:
mode:
authorfengweihao <[email protected]>2019-05-23 20:38:02 +0800
committerzhengchao <[email protected]>2019-05-24 18:49:12 +0800
commite02c5d59394b3bae6986038ea06654b3e331d168 (patch)
tree18b9c6f1b0beb0e29c1af7944122c5d6da14bd9a /plugin/business/pangu-http/src/test_pattern_replace.cpp
parent913313bd86758088facb72493705affa43f1a1a0 (diff)
1.修改js注入页面显示无效字符问题
Diffstat (limited to 'plugin/business/pangu-http/src/test_pattern_replace.cpp')
-rw-r--r--plugin/business/pangu-http/src/test_pattern_replace.cpp17
1 files changed, 3 insertions, 14 deletions
diff --git a/plugin/business/pangu-http/src/test_pattern_replace.cpp b/plugin/business/pangu-http/src/test_pattern_replace.cpp
index b5ef209..0672703 100644
--- a/plugin/business/pangu-http/src/test_pattern_replace.cpp
+++ b/plugin/business/pangu-http/src/test_pattern_replace.cpp
@@ -120,13 +120,11 @@ TEST(PatternInsert, CSS)
char *input=NULL, *output=NULL;
size_t output_sz=0, input_sz = 0;
- input = rt_read_file(filename, &input_sz);
+ input = execute_read_file(filename, &input_sz);
EXPECT_TRUE(input_sz>0);
output_sz = insert_string(input, input_sz, NULL, custom, "css", &output);
- //printf("output = %s\n", output);
-
EXPECT_TRUE(output_sz>0);
EXPECT_TRUE(NULL!=strstr(output, custom));
free(output);
@@ -141,19 +139,14 @@ TEST(PatternInsert, after_body)
char *input=NULL, *output=NULL;
size_t output_sz=0, input_sz = 0;
- input = rt_read_file(filename, &input_sz);
+ input = execute_read_file(filename, &input_sz);
EXPECT_TRUE(input_sz>0);
-
output_sz = insert_string(input, input_sz, "after-page-load", custom, "js", &output);
- //printf("%s\n", output);
-
EXPECT_TRUE(output_sz>0);
EXPECT_TRUE(NULL!=strstr(output, custom));
-
free(input);
free(output);
- output = NULL;
}
TEST(PatternInsert, before_body)
@@ -164,18 +157,14 @@ TEST(PatternInsert, before_body)
char *input=NULL, *output=NULL;
size_t output_sz=0, input_sz = 0;
- input = rt_read_file(filename, &input_sz);
+ input = execute_read_file(filename, &input_sz);
EXPECT_TRUE(input_sz>0);
-
output_sz = insert_string(input, input_sz, "before-page-load", custom, "js", &output);
- //printf("%s\n", output);
EXPECT_TRUE(output_sz>0);
EXPECT_TRUE(NULL!=strstr(output, custom));
-
free(input);
free(output);
- output = NULL;
}
int main(int argc, char ** argv)