| 
									
										
										
										
											2017-12-20 23:33:53 +08:00
										 |  |  | package plugins | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-01-10 22:07:04 +08:00
										 |  |  | import ( | 
					
						
							|  |  |  | 	"testing" | 
					
						
							|  |  |  | ) | 
					
						
							| 
									
										
										
										
											2017-12-20 23:33:53 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-01-10 22:07:04 +08:00
										 |  |  | func TestComposeBinaryName(t *testing.T) { | 
					
						
							|  |  |  | 	tests := []struct { | 
					
						
							|  |  |  | 		name string | 
					
						
							|  |  |  | 		os   string | 
					
						
							|  |  |  | 		arch string | 
					
						
							| 
									
										
										
										
											2017-12-20 23:33:53 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-01-10 22:07:04 +08:00
										 |  |  | 		expectedPath string | 
					
						
							|  |  |  | 	}{ | 
					
						
							|  |  |  | 		{ | 
					
						
							|  |  |  | 			name:         "simple-json", | 
					
						
							|  |  |  | 			os:           "linux", | 
					
						
							|  |  |  | 			arch:         "amd64", | 
					
						
							|  |  |  | 			expectedPath: `simple-json_linux_amd64`, | 
					
						
							|  |  |  | 		}, | 
					
						
							|  |  |  | 		{ | 
					
						
							|  |  |  | 			name:         "simple-json", | 
					
						
							|  |  |  | 			os:           "windows", | 
					
						
							|  |  |  | 			arch:         "amd64", | 
					
						
							|  |  |  | 			expectedPath: `simple-json_windows_amd64.exe`, | 
					
						
							|  |  |  | 		}, | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	for _, v := range tests { | 
					
						
							|  |  |  | 		have := composeBinaryName(v.name, v.os, v.arch) | 
					
						
							|  |  |  | 		if have != v.expectedPath { | 
					
						
							|  |  |  | 			t.Errorf("expected %s got %s", v.expectedPath, have) | 
					
						
							|  |  |  | 		} | 
					
						
							| 
									
										
										
										
											2017-12-20 23:33:53 +08:00
										 |  |  | 	} | 
					
						
							|  |  |  | } |