@@ -24,21 +24,9 @@ test-route-urls route :name<main->, {
2424 };
2525}
2626
27- {
28- my $ * CRO-ROOT-URL = ' https://foobar.com' ;
29- test-route-urls route {
30- get : name<home >, -> {
31- is make-link(' home' ), ' /' , ' Basic call of a generator is correct' ;
32- is make-link(' home' ). relative, ' ' , ' Relative URL is correct' ;
33- is make-link(' home' ). absolute, ' /' , ' Absolute URL is correct' ;
34- is make-link(' home' ). url, ' https://foobar.com/' , ' CRO-ROOT-URL was used' ;
35- };
36- }
37- }
38-
3927test-route-urls route : name<main >, {
4028 get : name<home >, -> {
41- is make -link(' main.home' ), ' /' , ' Basic call of a generator by a qualified name is correct' ;
29+ is abs -link(' main.home' ), ' /' , ' Basic call of a generator by a qualified name is correct' ;
4230 };
4331}
4432
@@ -68,43 +56,43 @@ test-route-urls route {
6856
6957test-route-urls route {
7058 get : name<hello >, -> : $ a , : $ b {
71- is make -link(' hello' , : a(1 ), : b(2 )), ' /?a=1&b=2' ;
72- is make -link(' hello' , : a(1 )), ' /?a=1' ;
73- is make -link(' hello' , : b(2 )), ' /?b=2' ;
74- throws-like { make -link(' hello' , 1 ) }, Exception , message => " Extraneous arguments" ;
75- throws-like { make -link(' hello' , : c(3 )) }, Exception , message => " Extraneous named arguments: c." ;
76- throws-like { make -link(' hello' , : a(1 ), : c(3 )) }, Exception , message => " Extraneous named arguments: c." ;
59+ is abs -link(' hello' , : a(1 ), : b(2 )), ' /?a=1&b=2' ;
60+ is abs -link(' hello' , : a(1 )), ' /?a=1' ;
61+ is abs -link(' hello' , : b(2 )), ' /?b=2' ;
62+ throws-like { abs -link(' hello' , 1 ) }, Exception , message => " Extraneous arguments" ;
63+ throws-like { abs -link(' hello' , : c(3 )) }, Exception , message => " Extraneous named arguments: c." ;
64+ throws-like { abs -link(' hello' , : a(1 ), : c(3 )) }, Exception , message => " Extraneous named arguments: c." ;
7765 };
7866}
7967
8068test-route-urls route {
8169 get -> {
82- is make -link(' hello' , : a(1 ), : b(2 )), ' /?a=1&b=2' ;
83- throws-like { make -link(' hello' , : a(1 )) }, Exception , message => " Missing named arguments: b." ;
84- throws-like { make -link(' hello' , : b(2 )) }, Exception , message => " Missing named arguments: a." ;
85- throws-like { make -link(' hello' , 1 ) }, Exception , message => " Extraneous arguments" ;
86- throws-like { make -link(' hello' , : c(3 )) }, Exception , message => " Missing named arguments: a, b. Extraneous named arguments: c." ;
87- throws-like { make -link(' hello' , : a(1 ), : c(3 )) }, Exception , message => " Missing named arguments: b. Extraneous named arguments: c." ;
70+ is abs -link(' hello' , : a(1 ), : b(2 )), ' /?a=1&b=2' ;
71+ throws-like { abs -link(' hello' , : a(1 )) }, Exception , message => " Missing named arguments: b." ;
72+ throws-like { abs -link(' hello' , : b(2 )) }, Exception , message => " Missing named arguments: a." ;
73+ throws-like { abs -link(' hello' , 1 ) }, Exception , message => " Extraneous arguments" ;
74+ throws-like { abs -link(' hello' , : c(3 )) }, Exception , message => " Missing named arguments: a, b. Extraneous named arguments: c." ;
75+ throws-like { abs -link(' hello' , : a(1 ), : c(3 )) }, Exception , message => " Missing named arguments: b. Extraneous named arguments: c." ;
8876 }
8977
9078 get : name<hello >, -> : $ a ! , : $ b ! {};
9179}
9280
9381test-route-urls route {
9482 get -> {
95- is make -link(' css' ), ' /css' ;
96- is make -link(' css' , ' x' , ' y' , ' z' ), ' /css/x/y/z' ;
83+ is abs -link(' css' ), ' /css' ;
84+ is abs -link(' css' , ' x' , ' y' , ' z' ), ' /css/x/y/z' ;
9785 }
9886
9987 get : name<css >, -> ' css' , + a { };
10088}
10189
10290test-route-urls route {
10391 get -> {
104- is make -link(' css' ), ' /' , ' Splat with no args at all' ;
105- is make -link(' css' , ' x' , ' y' , ' z' ), ' /x/y/z' , ' Splat with no named args' ;
106- is make -link(' css' , : a(1 ), : b(2 ), : c(3 )), ' /?a=1&b=2&c=3' , ' Splat with no pos args' ;
107- is make -link(' css' , ' x' , ' y' , ' z' , : a(1 ), : b(2 ), :o ù(' Ÿ' )), ' /x/y/z?a=1&b=2&o%C3%B9=%C5%B8' , ' Splat with both types of args' ;
92+ is abs -link(' css' ), ' /' , ' Splat with no args at all' ;
93+ is abs -link(' css' , ' x' , ' y' , ' z' ), ' /x/y/z' , ' Splat with no named args' ;
94+ is abs -link(' css' , : a(1 ), : b(2 ), : c(3 )), ' /?a=1&b=2&c=3' , ' Splat with no pos args' ;
95+ is abs -link(' css' , ' x' , ' y' , ' z' , : a(1 ), : b(2 ), :o ù(' Ÿ' )), ' /x/y/z?a=1&b=2&o%C3%B9=%C5%B8' , ' Splat with both types of args' ;
10896 }
10997
11098 get : name<css >, -> * @ a , * % b { };
0 commit comments