Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Low-hanging bugs, unit test and code restructure #18

Merged
merged 2 commits into from
Feb 2, 2017
Merged

Conversation

kirsle
Copy link
Member

@kirsle kirsle commented Feb 2, 2017

This fixes some of the low-hanging bugs and also restructures the code and unit tests.

For the full details on changes, see the change log for v0.1.1, which this branch will become.

Major Changes

  • API Change: Package github.com/aichaos/rivescript-go/config has been removed and instead the config.Config type can be found in the root package as rivescript.Config. To migrate existing code, make these changes:

      import (
        "github.com/aichaos/rivescript-go"
    -   "github.com/aichaos/rivescript-go/config"
      )
    
      func main() {
    -   bot := rivescript.New(config.Config{
    +   bot := rivescript.New(rivescript.Config{
          Debug: true,
        })
        bot.LoadDirectory("eg/brain")
      }
  • API Change: the functions Reply(), SortReplies() and CurrentUser() return error objects now in addition to their old return values.

Bugs Fixed

This goes through all the code and cleans up variable names, deletes
unused functions, and fixes `go vet` errors.

This also adds `error` return values to Reply(), SortReplies() and
CurrentUser(), and adds more helpful error conditions to LoadFile() and
LoadDirectory() to catch common user mistakes.

And this fixes RemoveHandler() to delete any object macros already
loaded by that handler to protect against null pointer exceptions.
@kirsle kirsle merged commit b2781a8 into master Feb 2, 2017
@kirsle kirsle deleted the bugfixes branch April 30, 2017 23:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
1 participant