Fixed tests

This commit is contained in:
Noah Santschi-Cooney 2020-08-07 15:01:57 +01:00
parent f803ab3385
commit c322abe9af
No known key found for this signature in database
GPG key ID: 3B22282472C8AE48
4 changed files with 35 additions and 21 deletions

View file

@ -427,10 +427,12 @@ fn test_generate_merge_list_01() {
.collect::<Vec<&str>>()
.join("");
let merge_file = tmp_path + "/shaders/final.fsh.merge";
let truth = String::from_utf8(fs::read::<String>(merge_file).unwrap()).unwrap();
let merge_file = tmp_path.clone() + "/shaders/final.fsh.merge";
let mut truth = String::from_utf8(fs::read::<String>(merge_file).unwrap()).unwrap();
truth = truth.replacen("!!", &(tmp_path.clone()+"/shaders/"+"common.glsl"), 1);
truth = truth.replace("!!", &(tmp_path+"/shaders/"+"final.fsh"));
assert_that!(total, eq(truth));
server.endpoint.request_shutdown();
@ -465,9 +467,15 @@ fn test_generate_merge_list_02() {
.collect::<Vec<&str>>()
.join("");
let merge_file = tmp_path + "/shaders/final.fsh.merge";
let merge_file = tmp_path.clone() + "/shaders/final.fsh.merge";
let truth = String::from_utf8(fs::read::<String>(merge_file).unwrap()).unwrap();
let mut truth = String::from_utf8(fs::read::<String>(merge_file).unwrap()).unwrap();
for file in &["sample.glsl", "burger.glsl", "sample.glsl", "test.glsl", "sample.glsl"] {
let path = tmp_path.clone();
truth = truth.replacen("!!", &format!("{}/shaders/utils/{}", path, file), 1);
}
truth = truth.replacen("!!", &(tmp_path+"/shaders/final.fsh"), 1);
assert_that!(total, eq(truth));
@ -503,9 +511,15 @@ fn test_generate_merge_list_03() {
.collect::<Vec<&str>>()
.join("");
let merge_file = tmp_path + "/shaders/final.fsh.merge";
let merge_file = tmp_path.clone() + "/shaders/final.fsh.merge";
let truth = String::from_utf8(fs::read::<String>(merge_file).unwrap()).unwrap();
let mut truth = String::from_utf8(fs::read::<String>(merge_file).unwrap()).unwrap();
for file in &["sample.glsl", "burger.glsl", "sample.glsl", "test.glsl", "sample.glsl"] {
let path = tmp_path.clone();
truth = truth.replacen("!!", &format!("{}/shaders/utils/{}", path, file), 1);
}
truth = truth.replacen("!!", &(tmp_path+"/shaders/final.fsh"), 1);
assert_that!(total, eq(truth));

View file

@ -1,10 +1,10 @@
#version 120
#line 1
#line 1 !!
float test() {
return 0.5;
}
#line 4
#line 4 !!
void main() {
gl_FragColor[0] = vec4(0.0);

View file

@ -1,26 +1,26 @@
#version 120
#line 1
#line 1 !!
int sample() {
return 5;
}
#line 1
#line 1 !!
void burger() {
// sample text
}
#line 6
#line 6 !!
#line 1
#line 1 !!
float test() {
return 3.0;
}
#line 8
#line 8 !!
int sample_more() {
return 5;
}
#line 4
#line 4 !!
void main() {
gl_FragColor = vec4(1.0, 1.0, 1.0, 1.0);

View file

@ -1,22 +1,22 @@
#version 120
#line 1
#line 1 !!
int sample() {
return 5;
}
#line 1
#line 1 !!
void burger() {
// sample text
}
#line 6
#line 6 !!
#line 1
#line 1 !!
float test() {
return 3.0;
}
#line 8
#line 4
#line 8 !!
#line 4 !!
void main() {
gl_FragColor = vec4(1.0, 1.0, 1.0, 1.0);