-
-
Notifications
You must be signed in to change notification settings - Fork 27
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'origin/main' into feature/implement-codec
- Loading branch information
Showing
29 changed files
with
1,093 additions
and
39 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
sub mocked { | ||
set req.http.Mocked = "1"; | ||
} | ||
|
||
sub mocked_func STRING { | ||
return "Mocked"; | ||
} | ||
|
||
describe group { | ||
|
||
before_recv { | ||
testing.mock("original", "mocked"); | ||
testing.mock("original_func", "mocked_func"); | ||
} | ||
|
||
after_recv { | ||
testing.restore_all_mocks(); | ||
unset req.http.Mocked; | ||
} | ||
|
||
// @scope: recv | ||
sub test_recv { | ||
testing.call_subroutine("vcl_recv"); | ||
assert.equal(req.http.Mocked, "1"); | ||
assert.is_notset(req.http.Original); | ||
assert.equal(req.http.FuncValue, "Mocked"); | ||
} | ||
|
||
// @scope: fetch | ||
sub test_fetch { | ||
testing.call_subroutine("vcl_fetch"); | ||
assert.equal(req.http.Original, "1"); | ||
assert.is_notset(req.http.Mocked); | ||
assert.equal(req.http.FuncValue, "Original"); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
// @scope: recv,fetch | ||
sub original { | ||
set req.http.Original = "1"; | ||
} | ||
|
||
// @scope: recv,fetch | ||
sub original_func STRING { | ||
return "Original"; | ||
} | ||
|
||
sub vcl_recv { | ||
#FASTLY RECV | ||
call original; | ||
set req.http.FuncValue = original_func(); | ||
} | ||
|
||
sub vcl_fetch { | ||
#FASTLY FETCH | ||
call original; | ||
set req.http.FuncValue = original_func(); | ||
} |
Oops, something went wrong.