From 7cafa62d20246ea17ff1d80bb75c930e8c44feef Mon Sep 17 00:00:00 2001 From: Hisham Muhammad Date: Wed, 13 Mar 2024 13:49:22 -0300 Subject: tests: replace new_version with quick tests --- spec/quick/new_version.q | 213 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 213 insertions(+) create mode 100644 spec/quick/new_version.q (limited to 'spec/quick') diff --git a/spec/quick/new_version.q b/spec/quick/new_version.q new file mode 100644 index 00000000..98426db4 --- /dev/null +++ b/spec/quick/new_version.q @@ -0,0 +1,213 @@ +SUITE: luarocks new_version + +================================================================================ +TEST: fails without a context + +RUN: luarocks new_version +EXIT: 1 + + + +================================================================================ +TEST: fails with invalid arg + +RUN: luarocks new_version i_dont_exist +EXIT: 1 + + + +================================================================================ +TEST: updates a version + +FILE: myexample-0.1-1.rockspec +-------------------------------------------------------------------------------- +package = "myexample" +version = "0.1-1" +source = { + url = "git+https://localhost/myexample.git", + tag = "v0.1" +} +description = { + summary = "xxx", + detailed = "xxx" +} +build = { + type = "builtin", + modules = { + foo = "src/foo.lua" + } +} +-------------------------------------------------------------------------------- + +RUN: luarocks new_version myexample-0.1-1.rockspec 0.2 + +FILE_CONTENTS: myexample-0.2-1.rockspec +-------------------------------------------------------------------------------- +package = "myexample" +version = "0.2-1" +source = { + url = "git+https://localhost/myexample.git", + tag = "v0.2" +} +description = { + summary = "xxx", + detailed = "xxx" +} +build = { + type = "builtin", + modules = { + foo = "src/foo.lua" + } +} +-------------------------------------------------------------------------------- + + + +================================================================================ +TEST: updates via tag + +FILE: myexample-0.1-1.rockspec +-------------------------------------------------------------------------------- +package = "myexample" +version = "0.1-1" +source = { + url = "git+https://localhost/myexample.git", + tag = "v0.1" +} +description = { + summary = "xxx", + detailed = "xxx" +} +build = { + type = "builtin", + modules = { + foo = "src/foo.lua" + } +} +-------------------------------------------------------------------------------- + +RUN: luarocks new_version myexample-0.1-1.rockspec --tag v0.2 + +FILE_CONTENTS: myexample-0.2-1.rockspec +-------------------------------------------------------------------------------- +package = "myexample" +version = "0.2-1" +source = { + url = "git+https://localhost/myexample.git", + tag = "v0.2" +} +description = { + summary = "xxx", + detailed = "xxx" +} +build = { + type = "builtin", + modules = { + foo = "src/foo.lua" + } +} +-------------------------------------------------------------------------------- + + + +================================================================================ +TEST: updates URL + +FILE: myexample-0.1-1.rockspec +-------------------------------------------------------------------------------- +package = "myexample" +version = "0.1-1" +source = { + url = "https://localhost/myexample-0.1.tar.gz", +} +description = { + summary = "xxx", + detailed = "xxx" +} +build = { + type = "builtin", + modules = { + foo = "src/foo.lua" + } +} +-------------------------------------------------------------------------------- + +RUN: luarocks new_version myexample-0.1-1.rockspec 0.2 https://localhost/newpath/myexample-0.2.tar.gz + +FILE_CONTENTS: myexample-0.2-1.rockspec +-------------------------------------------------------------------------------- +package = "myexample" +version = "0.2-1" +source = { + url = "https://localhost/newpath/myexample-0.2.tar.gz" +} +description = { + summary = "xxx", + detailed = "xxx" +} +build = { + type = "builtin", + modules = { + foo = "src/foo.lua" + } +} +-------------------------------------------------------------------------------- + + + +================================================================================ +TEST: updates MD5 + +FILE: test-1.0-1.rockspec +-------------------------------------------------------------------------------- +package = "test" +version = "1.0-1" +source = { + url = "file://%{url(%{fixtures_dir})}/an_upstream_tarball-0.1.tar.gz", + md5 = "dca2ac30ce6c27cbd8dac4dd8f447630", +} +build = { + type = "builtin", + modules = { + my_module = "src/my_module.lua" + }, + install = { + bin = { + "src/my_module.lua" + } + } +} +-------------------------------------------------------------------------------- + +RUN: luarocks new_version test-1.0-1.rockspec 2.0 file://%{url(%{fixtures_dir})}/busted_project-0.1.tar.gz + +FILE_CONTENTS: test-2.0-1.rockspec +-------------------------------------------------------------------------------- +package = "test" +version = "2.0-1" +source = { + url = "file://%{url(%{fixtures_dir})}/busted_project-0.1.tar.gz", + md5 = "adfdfb8f1caa2b1f935a578fb07536eb", +} +build = { + type = "builtin", + modules = { + my_module = "src/my_module.lua" + }, + install = { + bin = { + "src/my_module.lua" + } + } +} +-------------------------------------------------------------------------------- + + + +================================================================================ +TEST: takes a URL, downloads and bumps revision by default + +RUN: luarocks new_version file://%{url(%{fixtures_dir})}/a_rock-1.0-1.rockspec + +EXISTS: a_rock-1.0-1.rockspec +EXISTS: a_rock-1.0-2.rockspec -- cgit v1.2.3-55-g6feb