forked from evcc-io/evcc
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix decorators hiding optional interfaces (evcc-io#507)
Without this PR, decorating an api.Charger which has additional interfaces removed those interfaces from the decorated charger.
- Loading branch information
Showing
15 changed files
with
160 additions
and
81 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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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,36 @@ | ||
package charger | ||
|
||
import ( | ||
"testing" | ||
|
||
"github.com/andig/evcc/api" | ||
) | ||
|
||
func TestPhoenixEMCPDecorators(t *testing.T) { | ||
wb, err := NewPhoenixEMCPFromConfig(map[string]interface{}{ | ||
"meter": map[string]interface{}{ | ||
"power": true, | ||
"energy": true, | ||
"currents": true, | ||
}, | ||
}) | ||
if err != nil { | ||
t.Error(err) | ||
} | ||
|
||
if _, ok := wb.(api.Meter); !ok { | ||
t.Error("missing Meter api") | ||
} | ||
|
||
if _, ok := wb.(api.MeterEnergy); !ok { | ||
t.Error("missing MeterEnergy api") | ||
} | ||
|
||
if _, ok := wb.(api.MeterCurrent); !ok { | ||
t.Error("missing MeterCurrent api") | ||
} | ||
|
||
if _, ok := wb.(api.ChargeTimer); !ok { | ||
t.Error("missing ChargeTimer api") | ||
} | ||
} |
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
Oops, something went wrong.