(t *testing.T)
| 104 | } |
| 105 | |
| 106 | func TestTask_LookupByCommand(t *testing.T) { |
| 107 | tm := NewTaskManager() |
| 108 | tm.Create("sess-1", 1, "upload") |
| 109 | tm.Create("sess-1", 2, "exec") |
| 110 | |
| 111 | tm.BindCommand("sess-1", 1, "cmd_upload_1") |
| 112 | tm.BindCommand("sess-1", 1, "cmd_upload_2") |
| 113 | tm.BindCommand("sess-1", 2, "cmd_exec_1") |
| 114 | |
| 115 | if task := tm.LookupByCommand("cmd_upload_1"); task == nil || task.ID != 1 { |
| 116 | t.Error("should find upload task for cmd_upload_1") |
| 117 | } |
| 118 | if task := tm.LookupByCommand("cmd_exec_1"); task == nil || task.ID != 2 { |
| 119 | t.Error("should find exec task for cmd_exec_1") |
| 120 | } |
| 121 | if tm.LookupByCommand("nonexistent") != nil { |
| 122 | t.Error("should return nil for unknown command") |
| 123 | } |
| 124 | } |
| 125 | |
| 126 | func TestTask_AwaitResult(t *testing.T) { |
| 127 | tm := NewTaskManager() |
nothing calls this directly
no test coverage detected