| 
									
										
										
										
											2018-02-02 15:08:25 -08:00
										 |  |  | # Copyright Google Inc. All Rights Reserved. | 
					
						
							|  |  |  | # | 
					
						
							|  |  |  | # Use of this source code is governed by an MIT-style license that can be | 
					
						
							|  |  |  | # found in the LICENSE file at https://angular.io/license | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-10-25 01:13:43 -07:00
										 |  |  | load("@build_bazel_rules_nodejs//:index.bzl", "nodejs_binary", "nodejs_test") | 
					
						
							| 
									
										
										
										
											2018-02-02 15:08:25 -08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-04-25 20:41:05 +02:00
										 |  |  | """
 | 
					
						
							|  |  |  |   This test verifies that a set of top level symbols from a javascript file match a gold file. | 
					
						
							|  |  |  | """
 | 
					
						
							| 
									
										
										
										
											2018-02-02 15:08:25 -08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-10-04 13:14:14 -07:00
										 |  |  | def js_expected_symbol_test(name, src, golden, data = [], **kwargs): | 
					
						
							| 
									
										
										
										
											2018-08-07 16:15:45 -07:00
										 |  |  |     """This test verifies that a set of top level symbols from a javascript file match a gold file.
 | 
					
						
							|  |  |  |     """
 | 
					
						
							| 
									
										
										
										
											2018-10-18 09:58:38 -07:00
										 |  |  |     all_data = data + [ | 
					
						
							|  |  |  |         src, | 
					
						
							|  |  |  |         golden, | 
					
						
							|  |  |  |         Label("//tools/symbol-extractor:lib"), | 
					
						
							| 
									
										
										
										
											2019-02-20 09:54:42 -08:00
										 |  |  |         Label("@npm//typescript"), | 
					
						
							| 
									
										
										
										
											2018-10-18 09:58:38 -07:00
										 |  |  |     ] | 
					
						
							| 
									
										
										
										
											2019-06-07 13:38:06 -07:00
										 |  |  |     entry_point = "//tools/symbol-extractor:cli.ts" | 
					
						
							| 
									
										
										
										
											2018-02-02 15:08:25 -08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-08-07 16:15:45 -07:00
										 |  |  |     nodejs_test( | 
					
						
							|  |  |  |         name = name, | 
					
						
							|  |  |  |         data = all_data, | 
					
						
							|  |  |  |         entry_point = entry_point, | 
					
						
							|  |  |  |         templated_args = ["$(location %s)" % src, "$(location %s)" % golden], | 
					
						
							| 
									
										
										
										
											2018-10-25 20:48:41 -07:00
										 |  |  |         configuration_env_vars = ["compile"], | 
					
						
							| 
									
										
										
										
											2018-08-07 16:15:45 -07:00
										 |  |  |         **kwargs | 
					
						
							|  |  |  |     ) | 
					
						
							| 
									
										
										
										
											2018-03-21 10:55:14 -07:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-08-07 16:15:45 -07:00
										 |  |  |     nodejs_binary( | 
					
						
							|  |  |  |         name = name + ".accept", | 
					
						
							| 
									
										
										
										
											2018-08-14 16:18:26 -07:00
										 |  |  |         testonly = True, | 
					
						
							| 
									
										
										
										
											2018-08-07 16:15:45 -07:00
										 |  |  |         data = all_data, | 
					
						
							|  |  |  |         entry_point = entry_point, | 
					
						
							| 
									
										
										
										
											2018-10-25 20:48:41 -07:00
										 |  |  |         configuration_env_vars = ["compile"], | 
					
						
							| 
									
										
										
										
											2018-08-07 16:15:45 -07:00
										 |  |  |         templated_args = ["$(location %s)" % src, "$(location %s)" % golden, "--accept"], | 
					
						
							|  |  |  |         **kwargs | 
					
						
							|  |  |  |     ) |